エクスプローラの「ツール」メニューにある「ネットワークドライブの割り当て」メニューや「ネットワークドライブの切断」メニューを選択したときに表示されるダイアログはWNetConnectionDialogやWNetDisconnectDialog関数から利用できる。
#pragma comment(lib,"mpr.lib ")
//
// ネットワークドライブの割り当てダイアログ表示
//
bool ShowNetDriveConnectionDialog(HWND hParent)
{
DWORD dwRet;
dwRet = ::WNetConnectionDialog(hParent,RESOURCETYPE_DISK);
return (dwRet == NO_ERROR) ? true : false;
}
//
// ネットワークドライブの切断ダイアログの表示
//
bool ShowNetDriveDissconnectDialog(HWND hParent)
{
DWORD dwRet;
dwRet = ::WNetDisconnectDialog(hParent,RESOURCETYPE_DISK);
return (dwRet == NO_ERROR) ? true : false;
}
void Test(void)
{
ShowNetDriveConnectionDialog(NULL);
ShowNetDriveDissconnectDialog(NULL);
}
