以下是映射网络驱程器代码,为什么会出错,请大家帮忙处理,谢谢! (20分)

  • 主题发起人 主题发起人 tang_zhihua
  • 开始时间 开始时间
T

tang_zhihua

Unregistered / Unconfirmed
GUEST, unregistred user!
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 := 'x:'; {这为映射网驱动器}
NetR.lpRemoteName := '//SQL/share$';{这为映射网络路径,SQL是电脑名称,share$是共享名}
ErrInfo := WNetAddConnection2(NetR, '', '', 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 := 'x:'; {这为映射网驱动器}
NetR.lpRemoteName := '//SQL/share$';{这为映射网络路径,SQL是电脑名称,share$是共享名}
ErrInfo := WNetAddConnection2(NetR, '', '', CONNECT_UPDATE_PROFILE);
If ErrInfo = NO_ERROR Then
messagebox(0,'Net connection successful!','',0)
Else
messagebox(0,'ERROR: ','',0);
end;
 
后退
顶部