{=================================================================
功 能: 映射网络驱动器
参 数:
NetPath: 想要映射的网络路径
Password: 访问密码
Localpath 本地路径
返回值: 成功: True 失败: False;=================================================================}
Function NetAddConnection(NetPath: Pchar; PassWord: Pchar
;LocalPath: Pchar): Boolean;
var
Res: Dword;
begin
Result := False;
Res := WNetAddConnection(NetPath,Password,LocalPath);
if Res <> No_Error then exit;
Result := True;
end;
我要用这个函数,谁能给我例子????????谢谢啦,高分送
功 能: 映射网络驱动器
参 数:
NetPath: 想要映射的网络路径
Password: 访问密码
Localpath 本地路径
返回值: 成功: True 失败: False;=================================================================}
Function NetAddConnection(NetPath: Pchar; PassWord: Pchar
;LocalPath: Pchar): Boolean;
var
Res: Dword;
begin
Result := False;
Res := WNetAddConnection(NetPath,Password,LocalPath);
if Res <> No_Error then exit;
Result := True;
end;
我要用这个函数,谁能给我例子????????谢谢啦,高分送
真正的函数是WNetAddConnection,与此相同的还有WNetAddConnection2等var
NetSource: TNetResource;
begin
with NetSource do
begin
dwType := RESOURCETYPE_DISK;
lpLocalName := 'Z:';
lpRemoteName := '\\weichao\share';
lpProvider := '';
end;
if WNetAddConnection2(NetSource,'iamnaughtyboy','naughtyboy',CONNECT_UPDATE_PROFILE)=NO_ERROR then
showmessage('sucessful')
else
showmessage('fail');
end;最终的目的就是映射网络驱动器
相当于dos下的net use Z: \\ip\目录 password/user:username