Nö, klappt auch ohne Laufwerk
Delphi-Quellcode:
function TfrmDistributionMain.ConnectToMovieDir: boolean;
var
aNetResource: tNetResource;
Path: string;
dwres: dword;
begin
Path := ExcludeTrailingPathDelimiter(FPathToStorage);
FillChar(aNetResource, SizeOf(aNetResource), 0);
aNetResource.dwType := RESOURCETYPE_ANY;
aNetResource.lpLocalName := nil; // hier kann auch nil verwendet werden -> kein Laufwerk mapping
aNetResource.lpRemoteName := pChar(Path);
aNetResource.lpProvider := nil;
dwRes := WNetAddConnection2(aNetResource, pChar(Password), pChar(Username), 0);
result := (dwRes = NO_ERROR) or (dwRes = ERROR_ALREADY_ASSIGNED);
end;
Gruss