Registriert seit: 15. Dez 2002
Ort: Mittelfranken
980 Beiträge
Delphi 10 Seattle Enterprise
|
Re: Netzlaufwerk mit AS400
2. Feb 2006, 14:53
so sollte es gehen:
Delphi-Quellcode:
if DriveExists('O:') then
WNetCancelConnection2(PChar('O:'), 0, true);
ConnectToNetworkDrive('O:', '\\192.168.100.121\D$', 'Domain\Pfister',
'Geheim4711', false);
function TFHaupt.ConnectToNetworkDrive(Drive, Path, Username,
Password: string; RestoreAtLogon: boolean): DWORD;
var
NetResource: TNetResource;
dwFlags: DWORD;
begin
dwFlags := 0;
ZeroMemory(@NetResource, sizeof(TNetResource));
with NetResource do
begin
dwType := RESOURCETYPE_DISK;
lpLocalName := PChar(Drive);
lpRemoteName := PChar(Path);
lpProvider := nil;
end;
if (RestoreAtLogon) then
dwFlags := dwFlags or CONNECT_UPDATE_PROFILE;
Result := WNetAddConnection2(NetResource, PChar(Password), PChar(Username),
dwFlags);
end;
|
|
Zitat
|