映射网络盘。
procedure TForm1.btn1Click(Sender: TObject);
var
netStore: TNetResource;
begin
netStore.dwType := RESOURCETYPE_ANY;
netStore.lpLocalName := 'Z:';
netStore.lpRemoteName := '\\10.1.14.144\人力';
netStore.lpProvider := '';
WNetAddConnection2(netStore, PChar('gdpr'), PChar('administrator'), CONNECT_UPDATE_PROFILE);
if FileExists('Z:\EHR-10-12-广州地区公司.xls') then
ShowMessage('OK');
end;
var
netStore: TNetResource;
begin
netStore.dwType := RESOURCETYPE_ANY;
netStore.lpLocalName := 'Z:';
netStore.lpRemoteName := '\\10.1.14.144\人力';
netStore.lpProvider := '';
WNetAddConnection2(netStore, PChar('gdpr'), PChar('administrator'), CONNECT_UPDATE_PROFILE);
if FileExists('Z:\EHR-10-12-广州地区公司.xls') then
ShowMessage('OK');
end;
//断开网络连接:
WNetCancelConnection2( 'Z:', CONNECT_UPDATE_PROFILE, True);