[Up有分]高分求教:关于网络路径映射,先谢谢大家了!~

Lem0n 2003-09-12 02:09:37
给定一个共享路径,比如:\\Computer1\ShareFiles\
我想在程序中将该共享目录映射为本地一个虚拟盘,并且盘符要求是本地原有最大盘符的下一个,如本地原有A: C: D: E:四个,映射之后的盘符就要求为F:

然后进行文件复制操作,将F:(即\\Computer1\ShareFiles\)下的所有文件复制到本地C:\temp下,
复制完之后取消映射。

先谢谢大家了!~~~
...全文
50 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
zjqyb 2003-09-15
  • 打赏
  • 举报
回复
net use对应的Api是 WNetAddConnection2
alexhn 2003-09-14
  • 打赏
  • 举报
回复
UP
Lem0n 2003-09-13
  • 打赏
  • 举报
回复
怎样遍历盘符啊?
还有net use对应的Api是什么呢?
suhuoqiang 2003-09-13
  • 打赏
  • 举报
回复
up
hongqi162 2003-09-12
  • 打赏
  • 举报
回复
up
proZeus 2003-09-12
  • 打赏
  • 举报
回复
http://expert.csdn.net/Expert/topic/2086/2086100.xml
zjqyb 2003-09-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; 。
coolfilm 2003-09-12
  • 打赏
  • 举报
回复
先篇历盘符。net use
sundayzhao 2003-09-12
  • 打赏
  • 举报
回复
为什么要这样呢,直接拷贝不久可以了么。

1,183

社区成员

发帖
与我相关
我的任务
社区描述
Delphi Windows SDK/API
社区管理员
  • Windows SDK/API社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧