Q> Как подключить сетевой диск?
A>

DWORD ConnectRemoteDrive(LPSTR ShareName,LPSTR LocalDrive)
{
NETRESOURCE nr;
ZeroMemory(&nr,sizeof(nr));

nr.dwScope=RESOURCE_GLOBALNET;
nr.dwType=RESOURCETYPE_DISK;//RESOURCETYPE_ANY;
nr.dwDisplayType=RESOURCEDISPLAYTYPE_GENERIC;
nr.dwUsage=RESOURCEUSAGE_CONNECTABLE;
nr.lpLocalName=LocalDrive;
nr.lpRemoteName=ShareName;
nr.lpComment="";
nr.lpProvider=NULL;

return WNetAddConnection2(&nr, // NETRESOURCE from enumeration
(LPSTR) NULL, // no password
(LPSTR) NULL, // logged-in user
CONNECT_UPDATE_PROFILE); // update profile with connect info

}

 


Рейтинг@Mail.ru be number one Submitter.ru - Promoting!
Хостинг от uCoz