Author Topic: Map Network Drive Wizard  (Read 21882 times)

Tom

  • Junior Member
  • **
  • Posts: 45
    • View Profile
Map Network Drive Wizard
« on: October 02, 2016, 16:06:54 »
I'm new to MultiCommander, maybe I don't know yet all of the many features. As IT employee I have often to work with other devices, so I use often mappings to network shares. I miss functions to connect network shares to drive letters. I know that you can simply start the "map network drive wizard" (known from Windows Explorer) with the following command:
Rundll32 Shell32.dll,SHHelpShortcuts_RunDLL Connect

I think I could create a user defined command but maybe this would be of public interest and could be generally included to MC.

Unfortunately there is no known command to show the disconnect network drive wizard (known from Windows Explorer) but right-click on a drive letter in the drive bar will show the disconnect command for this single drive.

Mathias (Author)

  • Administrator
  • VIP Member
  • *****
  • Posts: 4416
    • View Profile
    • Multi Commander
Re: Map Network Drive Wizard
« Reply #1 on: October 02, 2016, 18:12:39 »
"map network drive" is in the popup menu when you right click on a network share


Tom

  • Junior Member
  • **
  • Posts: 45
    • View Profile
Re: Map Network Drive Wizard
« Reply #2 on: October 02, 2016, 19:13:20 »
I'm not sure where you are able to right-click on a network share to see this command. I have set the Commander Style Look& Feel, no tree view visible.

Mathias (Author)

  • Administrator
  • VIP Member
  • *****
  • Posts: 4416
    • View Profile
    • Multi Commander
Re: Map Network Drive Wizard
« Reply #3 on: October 02, 2016, 23:02:49 »
When you browse the network  in MC
eg "NET: - Network" in dropdown  or if you go directly to the server with a path \\server\
then all shares are listed.. and to show popup you then right click or right click and hold, or double right click (all depending on mouse configuration)

Tom

  • Junior Member
  • **
  • Posts: 45
    • View Profile
Re: Map Network Drive Wizard
« Reply #4 on: October 03, 2016, 11:10:29 »
Ok, I found what you told. But NET: only shows the servers and shares in the same network where my own PC resides. At work we devided the network into several virtual LANs (VLANs). And the network discovery only sees servers and shares within the own VLAN. As far as I understood this is due to the fact that the used protocol for network discovery isn't routed between the VLANs.

So sometimes I still would like the "Map Network Drive Wizard" to connect a drive letter to a Windows share in other VLANs which I cannot "see" with NET:.

What would be the problem to add the command
"Rundll32 Shell32.dll,SHHelpShortcuts_RunDLL Connect"
globally to a key? I would prefer F11 for "connect network drive".

I'm new to MC, so I have no experience yet with user defined commands and the keyboard customization. I'm pretty sure this can be done locally but I also think this would be of general interest.

Mathias (Author)

  • Administrator
  • VIP Member
  • *****
  • Posts: 4416
    • View Profile
    • Multi Commander
Re: Map Network Drive Wizard
« Reply #5 on: October 03, 2016, 12:30:10 »
Create a User Defined Command of type "External"
Paste that into that command.
Save it..
Press "Hotkey" and assign the hotkey you want to that command

Tom

  • Junior Member
  • **
  • Posts: 45
    • View Profile
Re: Map Network Drive Wizard
« Reply #6 on: October 03, 2016, 15:06:18 »
Done. F11 now starts the Map Network Drive Wizard.

Does anybody knows how to start the Disconnect Network Drive Wizard? Unfortunately the command
rundll32.exe shell32.dll,SHHelpShortcuts_RunDLL Disconnect

does not work anymore in newer Windows versions.

Mathias (Author)

  • Administrator
  • VIP Member
  • *****
  • Posts: 4416
    • View Profile
    • Multi Commander
Re: Map Network Drive Wizard
« Reply #7 on: October 03, 2016, 16:47:19 »
I Don't know how to show the UI,  But you can always script it :)

Code: [Select]
net use <device> /delete
But you will have to provide the device to unmount as a paramter to the script.
Or just create a script for each drive you normally mount and add them to its own menu command..


Tom

  • Junior Member
  • **
  • Posts: 45
    • View Profile
Re: Map Network Drive Wizard
« Reply #8 on: October 04, 2016, 21:03:24 »
As I already wrote, a right-click on a drive letter in MC drive bar will show the disconnect command for this single drive. So it's already possible to disconnect from MC.

Anyway, other Commander use F12 to launch the "Disconnect Network Drive Wizard" (e.g. Altap Salamander, DoubleCmd). So I'm familiar with this key. And you can disconnect several drives at once from the wizard.

As far as I found hints, usually the WNetDisconnectDialog function (https://msdn.microsoft.com/en-us/library/windows/desktop/aa385440(v=vs.85).aspx) is used to launch the disconnect wizard but since Windows 2003 exists no more connection to the shell32.dll, so it cannot be launched from Rundll32. Instead it's related to mpr.dll.

Tom

  • Junior Member
  • **
  • Posts: 45
    • View Profile
Re: Map Network Drive Wizard
« Reply #9 on: October 17, 2016, 20:34:18 »
Found a quick and dirty way to launch the disconnect wizard with F12 with help of a small AutoIt script.

Create a file called DisconnectDialog.au3 with the following lines:
Local $hWnd = WinGetHandle ("[CLASS:MultiCommander]")
#include <WinNet.au3>
_WinNet_DisconnectDialog( $hWnd )
WinWaitActive( $hwnd)
WinClose($hWnd)
Exit 1

Then compile this with Aut2exe.exe. This creates a file called DisconnectDialog.exe. This executable opens the disconnect wizard, which works as expected. Unfortunately this exe never ends. It just pauses the script. In the system tray an AutoIt icon called DisconnectDialog.exe is still running. If you run this exe several times you'll have several AutoIt icons in the system tray. I found no way to auto-terminate the AutoIt script from the script itself.

So I also created a batch called DisconnectDialog.cmd with the lines:
@echo off
taskkill /F /IM "DisconnectDialog.exe" > NUL:
start DisconnectDialog.exe

If DisconnectDialog.exe was started before, the process is killed. To see no error message in case that no old process DisconnectDialog.exe exists I send the output of the taskkill command to nirwana.

Put the two files DisconnectDialog.cmd and DisconnectDialog.exe in a directory found in path (e.g. C:\Windows). Then just create a user defined command which runs DisconnectDialog.cmd and define a hotkey F12 for this.

So you could run the disconnect wizard as often as you want but you will have at max only one AutoIt icon in system tray.

Anyway, would be better if these wizards would be included as commands in MC in a future version.
« Last Edit: October 17, 2016, 20:56:14 by Tom »

Tom

  • Junior Member
  • **
  • Posts: 45
    • View Profile
Re: Map Network Drive Wizard
« Reply #10 on: October 17, 2016, 20:54:55 »
Ok, tested with W7. In W10 the taskkill command should include the /F (aka force) parameter. Otherwise only an end signal is send to the process (which is then ignored). With the command taskkill /F /IM "DisconnectDialog.exe" the process is forced to be killed.