| 网站首页 | JAVA文章 | AppServers | Web开发 | 应用开发 | 资源下载 | 论坛
    想学好编程,学好外语很重要  [enadd  2006年12月25日]        
设为首页 加入收藏 联系站长
您现在的位置: 编程笔记网 >> 应用开发 >> delphi >> 网络开发 >> 文章正文
如何映射网络驱动器          【字体:
如何映射网络驱动器
作者:不祥    文章来源:-    点击数:    更新时间:2006-12-12

如何映射网络驱动器

function WNetAddConnection2W(var lpNetResource: TNetResourceW;

lpPassword, lpUserName: PWideChar;
dwFlags: DWORD): DWORD; stdcall;

To make the call you will need to fill a lpNetResource structure
with a minimum set of parameters, shown in the example below. You
pass this structure as the first parameter to the call, the password,
user name, and a flag that indicates whether this mapping should
be persistant every time the machine is logged onto. For more info
on the API itself, see Window's Programmers Reference help (find the

function in Windows.pas, place your text cursor over the function
call, and hit F1 to bring up help).

procedure TForm1.Button1Click(Sender: TObject);
var
NRW: TNetResource;
begin
with NRW do
begin
dwType := RESOURCETYPE_ANY;
lpLocalName := 'X:'; // map to this driver letter
lpRemoteName := '\\MyServer\MyDirectory';
// Must be filled in. If an empty string is used,
// it will use the lpRemoteName.
lpProvider := '';
end;
WNetAddConnection2(NRW, 'MyPassword', 'MyUserName',

CONNECT_UPDATE_PROFILE);
end; 。

[1]

文章录入:enadd    责任编辑:enadd 
  • 上一篇文章:

  • 下一篇文章:
  • 发表评论】【加入收藏】【告诉好友】【打印此文】【关闭窗口
    最新热点 最新推荐 相关文章
  • 运用Delphi编写Windows NT中…

  • 用Delphi编写CGI程序返回图象

  • Email 服务器的简单实现

  • Delphi多层应用程序的实现

  • Delphi4.0 开发WEBMAIL程序

  • Delphi中串行通信的实现

  • 提高客户机/服务器应用系统性…

  • 在程序中动态取得Win95/98网…

  • 链接的视觉效果

  • 打开拨号连接

  •   网友评论:(只显示最新10条。评论内容只代表网友观点,与本站立场无关!)
    | 设为首页 | 加入收藏 | 联系站长 | 友情链接 | 版权申明 | 管理登录 |