Var NetSource: TNetResource; file: // Connect the server structure DWRESULT: DWORD; File: / / Connect the return value of the file server
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); '! attached file servers fail' if dwResult <> 0 then begin MessageDlg (# 13 # 10 'reset the!', mtWarning, [mbOk], 0); g_bflag: = FALSE; END;
Procedure disconnectServer; Begin IF G_BFLAG THEN WNETCANCELCONNECTION2 (Pansichar ('//' g_sserverip), connect_update_profile, true);