Y
yueli100
Unregistered / Unconfirmed
GUEST, unregistred user!
我通过手工配置用户名为'xcw',密码为'791127',成功!
而通过代码失败,请高手帮帮看,是什么原因?
我的代码如下:
procedure TForm1.Button1Click(Sender: TObject);
var NetR :NETRESOURCE;ErrInfo : Longint;
begin
NetR.dwScope := RESOURCE_GLOBALNET;
NetR.dwType := RESOURCETYPE_DISK;
NetR.dwDisplayType := RESOURCEDISPLAYTYPE_SHARE;
NetR.dwUsage := RESOURCEUSAGE_CONNECTABLE;
NetR.lpLocalName := 'I:';
NetR.lpRemoteName := '//Lgserver/jt';
ErrInfo := WNetAddConnection2(NetR,'791127','xcw',CONNECT_UPDATE_PROFILE);
If ErrInfo = NO_ERROR Then
messagebox(0,'Net connection successful!','',0)
else
messagebox(0,'ERROR: ','',0);
end;
而通过代码失败,请高手帮帮看,是什么原因?
我的代码如下:
procedure TForm1.Button1Click(Sender: TObject);
var NetR :NETRESOURCE;ErrInfo : Longint;
begin
NetR.dwScope := RESOURCE_GLOBALNET;
NetR.dwType := RESOURCETYPE_DISK;
NetR.dwDisplayType := RESOURCEDISPLAYTYPE_SHARE;
NetR.dwUsage := RESOURCEUSAGE_CONNECTABLE;
NetR.lpLocalName := 'I:';
NetR.lpRemoteName := '//Lgserver/jt';
ErrInfo := WNetAddConnection2(NetR,'791127','xcw',CONNECT_UPDATE_PROFILE);
If ErrInfo = NO_ERROR Then
messagebox(0,'Net connection successful!','',0)
else
messagebox(0,'ERROR: ','',0);
end;