各位高手:
遇到这样一个问题,我想将服务器映射到我本地,以便进行操作,我采用的函数:WNetAddConnection,我所要映射的服务器是liunx,给我提供了一个共享目录名称(用户名称)liuys、密码windows、要映射到本地(windows2000)为z:\,我是这样写的WNetAddConnection('\\liuys','windows','z:\');但是这样的写法怎么也通不过,不知道错误在哪里,WNetAddConnection的windowsSDK帮助也没有说明里面的字符串的格式怎么写,请问各位高手我错在哪里?注释说明。如果各位有更好的解决方案,可以将源代码给我粘贴过来,谢谢
遇到这样一个问题,我想将服务器映射到我本地,以便进行操作,我采用的函数:WNetAddConnection,我所要映射的服务器是liunx,给我提供了一个共享目录名称(用户名称)liuys、密码windows、要映射到本地(windows2000)为z:\,我是这样写的WNetAddConnection('\\liuys','windows','z:\');但是这样的写法怎么也通不过,不知道错误在哪里,WNetAddConnection的windowsSDK帮助也没有说明里面的字符串的格式怎么写,请问各位高手我错在哪里?注释说明。如果各位有更好的解决方案,可以将源代码给我粘贴过来,谢谢
http://expert.csdn.net/Expert/topic/2544/2544494.xml?temp=.227749你的问题可以参考:
Function NetAddConnection(NetPath: Pchar; PassWord: Pchar; LocalPath: Pchar): Boolean;
var
Res: Dword;
begin
Result := False;
Res := WNetAddConnection(NetPath,Password,LocalPath);
showmessage(inttostr(res));
if Res <> No_Error then
exit;
Result := True;
end;procedure TForm1.Button2Click(Sender: TObject);
var
b: boolean;
begin
b := NetAddConnection('\\llq\FFMBS','llq','k:');
if b then
showmessage('ok')
else
showmessage('no');
end;