- UID
- 2261
注册时间2005-7-5
阅读权限20
最后登录1970-1-1
以武会友
TA的每日心情 | 开心 2019-9-19 16:05 |
---|
签到天数: 4 天 [LV.2]偶尔看看I
|
var
NetSource : TNetResource; file://连接服务器结构
dwResult:DWORD; file://连接文件服务器的返回值
procedure ConnectServer;
begin
g_bFlag:=True;
NetSource.dwType:= RESOURCETYPE_ANY;
NetSource.lpLocalName:='';
NetSource.lpRemoteName:=PAnsiChar('\\'+g_sServerIp);
NetSource.lpProvider:='';
dwResult:=WnetAddConnection2(NetSource,PAnsiChar(g_sServerPassWord),PAnsiChar(g_sServerUserName),CONNECT_UPDATE_PROFILE);
if dwResult<>0 then
begin
MessageDlg('连接文件服务器失败!'#13#10'请重新设置!',mtWarning,[mbOk],0);
g_bFlag:=False;
end;
end;
procedure DisconnectServer;
begin
if g_bFlag then
WNetCancelConnection2(PAnsiChar('\\'+g_sServerIp), CONNECT_UPDATE_PROFILE, True);
end; |
|