我的一个程序要备份数据到另一机器上,我在另一台机器上设了一个帐号和一个密码,我想打开另一台机器上的文件,但是不想通过网上邻居的对话框输入用户名和密码,我想把用户名和密码放在程序中,用NetUseAdd直接联,可是程序只能这样写
ui2.ui2_local = NULL;
ui2.ui2_remote = (LMSTR) RemoteResource;
ui2.ui2_asg_type = USE_IPC;
ui2.ui2_password = (LMSTR) L"";
ui2.ui2_username = (LMSTR) L"";
ui2.ui2_domainname = (LMSTR) L""; nas = NetUseAdd(NULL, 2, (LPBYTE)&ui2, NULL);
我把上面的用户名和密码改成非空在2000中就会出错,在XP中没事,请高手指点
ui2.ui2_local = NULL;
ui2.ui2_remote = (LMSTR) RemoteResource;
ui2.ui2_asg_type = USE_IPC;
ui2.ui2_password = (LMSTR) L"";
ui2.ui2_username = (LMSTR) L"";
ui2.ui2_domainname = (LMSTR) L""; nas = NetUseAdd(NULL, 2, (LPBYTE)&ui2, NULL);
我把上面的用户名和密码改成非空在2000中就会出错,在XP中没事,请高手指点
{
NETRESOURCE nr;
ZeroMemory(&nr, sizeof(nr));
nr.dwType=RESOURCETYPE_ANY;
nr.lpLocalName=NULL;
nr.lpRemoteName=Server;
nr.lpProvider=NULL;
return WNetAddConnection3(hWnd, &nr, Password, Login, 0);
}
{
NETRESOURCE nr;
ZeroMemory(&nr, sizeof(nr));
nr.dwType=RESOURCETYPE_ANY;
nr.lpLocalName=NULL;
nr.lpRemoteName=Server;
nr.lpProvider=NULL;
return WNetAddConnection2(&nr, Password, Login, 0);
}WNetCancelConnection2(Server,CONNECT_UPDATE_PROFILE,TRUE);