哪些树叶可以做标本:如何将我的电脑右键中属性,映射网络驱动器删掉呢?

来源:百度文库 编辑:高考问答 时间:2024/04/28 13:15:20
如何将我的电脑右键中属性,映射网络驱动器删掉等删掉呢!
谢谢!

建立网络驱动器的映射。
void CMountDlg::OnMountButton()
{
// TODO: Add your control notification handler code here
char netpath[MAX_PATH];
//输入的网络路径 m_NetpathEdit.GetWindowText(netpath, sizeof(netpath));
char drv[MAX_PATH];
//本地的驱动器盘符 m_DriveEdit.GetWindowText(drv, sizeof(drv));
NETRESOURCE netres; netres.dwScope=RESOURCE_GLOBALNET;
netres.dwType=RESOURCETYPE_ANY;
netres.dwDisplayType=RESOURCEDISPLAYTYPE_GENERIC;
netres.dwUsage=RESOURCEUSAGE_CONNECTABLE;
netres.lpLocalName=drv; netres.lpRemoteName=netpath;
netres.lpComment=NULL; netres.lpProvider=NULL;
DWORD rslt=WNetAddConnection2(&netres, NULL, NULL, 0);
CString str;
str.Format("WNetAddConnection2() return code=%d", rslt);
MessageBox(str);
}
取消网络驱动器的映射
void CMountDlg::OnUnmountButton()
{
// TODO: Add your control notification handler code here
char drv[MAX_PATH];
//本地的驱动器盘符
m_DriveEdit.GetWindowText(drv, sizeof(drv));
DWORD rslt=WNetCancelConnection2(drv, 0, FALSE);
CString str;
str.Format("WNetCancelConnection2() return code=%d", rslt);
MessageBox(str);
//显示信息成功与否 return code =0 成功 否则 建立失败
}