var NRW: TNetResource;
begin
with NRW do
begin
dwType:= RESOURCETYPE_ANY;
lpLocalName:=PChar(LocalDriver); //映射的网络驱动器,取自己最高盘符后面一个就可以了。
lpRemoteName:=PChar(ShareName); //共享文件夹名,例如 //hello/Share
lpProvider:='';
end;
result := WNetAddConnection2(NRW, PChar(Password), PChar(UserName), CONNECT_UPDATE_PROFILE);
end;