我想把远程的机子上的共享文件夹中的文件剪切到本地,需要输入密码(如果不输入,用户和密码,操作失败,win2000系统)
例如:远程计算机 ip=192.168.0.130
user=sa
key=sa
共享文件夹为:d://cmis//exch//xcaq//put//*.dat
本地计算机 ip=192.168.0.253
本地存放文件的目录为:d://datainfra//file//
例如:远程计算机 ip=192.168.0.130
user=sa
key=sa
共享文件夹为:d://cmis//exch//xcaq//put//*.dat
本地计算机 ip=192.168.0.253
本地存放文件的目录为:d://datainfra//file//
解决方案 »
- 皮肤库是如何工作的?
- ShowWindow 会卡死程序
- 请教各位高手从一个区域向另一个区域画线不能实现?
- udp检验和计算实现的代码 出错 请问原因
- 请教一下, 那些小网站靠什么赚钱?
- ClistCtrl自排序问题(附代码)
- 有关图片显示的问题(线程)
- 偶也想要孙鑫VC++视频教,不过没钱买,那位知道哪可以下载呀!
- 有那位大虾知道,如何把窗口创建成三角形或其他特殊形状!!!请指教!!!
- 该死的VC,同样一段读注册表的代码,在主线程里就OK,在另一个工作线程就虾米。太可恶了,我要声讨VC。还有一段该死的使菜单选项变灰的代码,同一个地方,同样的代码,就是菜单的ID 不同,就有一个菜单能被变灰了,而另一个菜单就不变。太可气了!!
- 要大虾啦!VC++在debug版本可以用,在生成release时一直出错,不是内存出错就是初始化出错。。。晕啊
- 颜色问题,怎么根据选中前字体的颜色来确定选中后的颜色,使得和选中的背景颜色达到最佳?
LPNETRESOURCE lpNetResource,
LPCTSTR lpPassword,
LPCTSTR lpUsername,
DWORD dwFlags
);
建立共享管道。
然后和本地操作没什么区别,注意要有可写的权限才行,
远程的目录是“\\\\192.168.0.130\\$(ShareName)\\.....”,
注$(ShareName)是共享文件夹的名字。注意:未验证。
主要是 LPNETRESOURCE lpNetResource 和 DWORD dwFlags
要剪切,你有写权限没?
还有在你那失败,错误代码是多少?Example code:
DWORD dwResult;
NETRESOURCE nr;
//
// Call the WNetAddConnection2 function to make the connection,
// specifying a persistent connection.
//
dwResult = WNetAddConnection2(&nr, // NETRESOURCE from enumeration
(LPSTR) NULL, // no password
(LPSTR) NULL, // logged-in user
CONNECT_UPDATE_PROFILE); // update profile with connect information
// Process errors.
// The local device is already connected to a network resource.
//
if (dwResult == ERROR_ALREADY_ASSIGNED)
{
TextOut(hdc, 10, 10, "Already connected to specified resource.", 40);
return FALSE;
}
// An entry for the local device already exists in the user profile.
//
else if (dwResult == ERROR_DEVICE_ALREADY_REMEMBERED)
{
TextOut(hdc, 10, 10,
"Attempted reassignment of remembered device.", 44);
return FALSE;
}
else if(dwResult != NO_ERROR)
{
//
// Call an application-defined error handler.
//
NetErrorHandler(hwnd, dwResult, (LPSTR)"WNetAddConnection2");
return FALSE;
}
//
// Otherwise, report a successful connection.
//
TextOut(hdc, 10, 10, "Connected to specified resource.", 32);
Debug/DataTrans.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.是不是缺少什么库函数呀!
Client Requires Windows XP, Windows 2000 Professional, Windows NT Workstation, Windows Me, Windows 98, or Windows 95.
Server Requires Windows Server 2003, Windows 2000 Server, or Windows NT Server.
Header Declared in Winnetwk.h.
Library Link to Mpr.lib.
DLL Requires Mpr.dll.
Unicode Implemented as WNetAddConnection2W (Unicode) and WNetAddConnection2A (ANSI). Note that Unicode support on Windows Me/98/95 requires Microsoft Layer for Unicode.
需要mpr.lib
然后 rebuild 工程 ...