Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

Activating the "Run" dialog

May
12,845
164
With Win7's new GUI, it's not easy to get to the (good old) "Run" dialog without a Win key (and I don't have a Win key). I first wrote a little app to simulate Win+R (that'll do it) and assigned it to a hotkey ... only to realize that that strategy will never work because my hotkey combination is depressed when Win+R is simulated. And a delay would not be acceptable.

Then Google helped me find this tidbit.
Code:
rundll32.exe shell32.dll,#61

That'll do it. But it leaves me with a question (and hoping for some speculation). When that's done repeatedly, each Run dialog is a bit lower and to the right than the previous one (whether or not the previous one has been dismissed) ... common behavior in Windows. But when I do the same thing (I suppose) with code like that below, the Dialog opens at (0,0) every time. Would anyone care to speculate on the difference? From what I could Google, none of parameters of SHELL32.DLL/Ordinal#61 have anything to do with position.

Code:
    typedef INT (WINAPI *RUN_DIALOG_TYPE)(HWND, HICON, LPWSTR, LPWSTR, LPWSTR, INT);
    HMODULE hShell32 = LoadLibrary(L"SHELL32.DLL");
    RUN_DIALOG_TYPE RunDialog = (RUN_DIALOG_TYPE) GetProcAddress(hShell32, (LPCSTR) 61);
    RunDialog(NULL, NULL, NULL, NULL, NULL, 0);
 
I think that's one of those things that Windows positions "automatically".

Btw, right click the taskbar->Properties->Start Menu tab->Customize button->scroll down to Run command and tick it. :)
 
I think that's one of those things that Windows positions "automatically".

Btw, right click the taskbar->Properties->Start Menu tab->Customize button->scroll down to Run command and tick it. :)
I know that, but without a Win key I either must navigate to it with the mouse or Ctrl-Esc, Right, Up, Enter.
 
Ah, gotcha.

As another aside, then, did know you can run things from the "Search programs and files" field too? Type cmd/msconfig/shortcut name/et. and hit Enter (as long as what you're going for is highlighted above).
 
Ah, gotcha.

As another aside, then, did know you can run things from the "Search programs and files" field too? Type cmd/msconfig/shortcut name/et. and hit Enter (as long as what you're going for is highlighted above).
I have often done that. But that has no memory, no browse.
 
With Win7's new GUI, it's not easy to get to the (good old) "Run" dialog without a Win key (and I don't have a Win key). I first wrote a little app to simulate Win+R (that'll do it) and assigned it to a hotkey ... only to realize that that strategy will never work because my hotkey combination is depressed when Win+R is simulated. And a delay would not be acceptable.

Then Google helped me find this tidbit.
Code:
rundll32.exe shell32.dll,#61

I did not know that. But you know that you can create a shortcut to the Run dialog?
Code:
[URL='http://prospero.unm.edu/plugins/uistuff.html#mksc']mksc[/URL] "%@shfolder[16]\Run Dialog.lnk" "<Run...>"
 
I have become more reliant on hotkeys (with my own hotkey server). One reason is that things pinned to the taskbar (like FireFox) and things on their jumplists annoyingly steal focus (in the sense that you don't go back to the app you were in after starting (then closing) something from the taskbar).
I have quite a few and plenty of key combos left.

Code:
Key: Ctrl-Alt-d
Command: G:\Uty\schtasks.exe /run /tn dtswitch [switch to services desktop]
Directory: g:\uty
 
Key: Ctrl-Alt-a
Command: g:\uty\schtasks.exe /run /tn TCC [TCC as admin]
Directory: g:\uty
 
Key: Ctrl-Alt-s
Command: g:\uty\showdesk.exe
Directory: g:\uty
 
Key: f9
Command: g:\uty\toggletcc.exe "g:\tc14\tcc.exe /q"
Directory: v:\
 
Key: f8
Command: g:\tc14\tcc.exe /q
Directory: v:\
 
Key: Ctrl-Alt-f
Command: l:\Firefox\firefox.exe
Directory: l:\Firefox\
 
Key: Ctrl-Alt-t
Command: taskmgr.exe
Directory: c:\Windows\System32\
 
Key: Ctrl-Alt-j
Command: l:\firefox\firefox.exe http://jpsoft.com/forums/
Directory: l:\Firefox\
 
Key: Ctrl-Alt-w
Command: l:\firefox\firefox.exe "http://forecast.weather.gov/MapClick.php?CityNa
me=Syracuse&state=NY&site=BGM&textField1=43.0446&textField2=-76.1459&e=0"
Directory: l:\firefox
 
Key: Ctrl-Alt-r
Command: g:\uty\startrun.exe
Directory: g:\uty
 
Vince:
For hotkeys that are to be executed by Windows itself I switched to the ACS (alt-control-shift) combination of modifiers, which are always intercepted by the OS and never delivered to applications, whether or not an OS action is connected. OTOH, any hotkey using either a single-key or a double-key modifier that is not explicitly intercepted by the OS is delivered to the current application window, and for each one of two key modifier combination I have at least one using application. I can press CS with a single finger, so it is no difficulty to deal with ACS instead of AC. Of course, your requirements may be different...
--
Steve
 
Vince:
For hotkeys that are to be executed by Windows itself I switched to the ACS (alt-control-shift) combination of modifiers, which are always intercepted by the OS and never delivered to applications, whether or not an OS action is connected. OTOH, any hotkey using either a single-key or a double-key modifier that is not explicitly intercepted by the OS is delivered to the current application window, and for each one of two key modifier combination I have at least one using application. I can press CS with a single finger, so it is no difficulty to deal with ACS instead of AC. Of course, your requirements may be different...
I can use, and have used, Ctrl-Alt-Shift hotkeys but there's no need to do so. My server used RegisterHotKey() which defined system-wide hotkeys. My hot keys work under any circumstances. I even included the ability to include the "Win" modifier but, not having a Win key, it has never been tested.
 
I even included the ability to include the "Win" modifier but, not having a Win key, it has never been tested.

One wonders whether the older AnyKey keyboards could be made to produce the Win-key keycode. Perhaps by hacking the settings backup file with a hex editor?

I know that they can be programmed to produce the Ctrl-Esc keystroke that opens the Start menu, but that's not useful as a modifier key.
 
One wonders whether the older AnyKey keyboards could be made to produce the Win-key keycode. Perhaps by hacking the settings backup file with a hex editor?

I know that they can be programmed to produce the Ctrl-Esc keystroke that opens the Start menu, but that's not useful as a modifier key.
I lost the ability to use a KB config file many versions of Windows ago (when I went from 95 to NT4, I think). The software just didn't work. MaxiSwitch even once sent me the source for it but I couldn't get it working (knowing darn little about Win32 at that time).
 
Vince:
I was referring to the need that some cntl-alt modified keystrokes may be needed by applications. Each single-modifier+key and each double-modifier+key is used in some application or another on my system. Because the SHORTCUT command (and Charles' MKSC plugin command) do NOT understand the WIN modifier, and I wanted a single modifier combination for all my hotkeys meant for Windows, I found alt-cntl-shift that did the job, without interfering with hotkeys for any application I use. I suppose if either MKSC or SHORTCUT could create / analyze shortcut files using the WIN modifier, I'd use that... All my keyboards have Win keys, so that's not an issue here.
 
Vince, I make you a gift:
winkey.jpg
:happy:
 
Autohotkey fully handles and simulates the Windows key. I invoke the run dialog on my machine by using Ctrl-Alt-R. The single-line Autohotkey script which does the mapping for me is the following:

Code:
^!r::Send {vk5Bsc15B down}{vk52sc013}{vk5Bsc15B up}

(vk5Bsc15B specifies the virtual key code and scan code of the Windows key, and vk52sc013 is for the "r" key. Note that it's also possible to do it in AHK with the much simpler line "^!r::#r"; however, that only works if the currently active keyboard is for a latin-based language. In order to support the hotkey across all languages, I used the scancodes instead).

P.S. I've also noticed in the past the odd placement behavior of the "rundll32.exe shell32.dll,#61" command, together with the fact that it's invocation involves a significant latency as compared with the direct Windows-R keypress. Using the AHK script above avoid both problems, but it remains a curiosity to understand why the rundll32 command does not exactly reproduce the Win-R behavior.
 
Autohotkey fully handles and simulates the Windows key. I invoke the run dialog on my machine by using Ctrl-Alt-R. The single-line Autohotkey script which does the mapping for me is the following:

Code:
^!r::Send {vk5Bsc15B down}{vk52sc013}{vk5Bsc15B up}

(vk5Bsc15B specifies the virtual key code and scan code of the Windows key, and vk52sc013 is for the "r" key. Note that it's also possible to do it in AHK with the much simpler line "^!r::#r"; however, that only works if the currently active keyboard is for a latin-based language. In order to support the hotkey across all languages, I used the scancodes instead).

P.S. I've also noticed in the past the odd placement behavior of the "rundll32.exe shell32.dll,#61" command, together with the fact that it's invocation involves a significant latency as compared with the direct Windows-R keypress. Using the AHK script above avoid both problems, but it remains a curiosity to understand why the rundll32 command does not exactly reproduce the Win-R behavior.
 
When I get around to it, I'll use the windows scan-code map mechanism (see http://msdn.microsoft.com/en-us/library/windows/hardware/gg463447.aspx and HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layout) and probably turn [right-alt] into [Win]. I have done similar things manually in the past. I also have
Code:
1999-11-19  11:19        348,160  remapkey.exe
from an old (NT4?) resource kit. It's supposed to do the same thing; it starts under Win7 but I'm not sure if it will work properly. I'm just waiting for an excuse to restart my machine.
 
P.S., I don't notice any delay using RUNDLL32. I wrote a little program which does the same (digs ordinal #61 out of shell32.dll, executes it, and places the dialog where I want it. That approach shows no significant delay either (and I can't see the window move).
 
That worked nicely:
Code:
Key: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layout
 
Value: (REG_BINARY) "Scancode Map" (w/o quotes)
 
Data: 00 00 00 00 00 00 00 00 02 00 00 00 5C E0 38 E0 00 00 00 00

Now I have a Win key (whoopie!).
 
That worked nicely:
Code:
Key: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layout
 
Value: (REG_BINARY) "Scancode Map" (w/o quotes)
 
Data: 00 00 00 00 00 00 00 00 02 00 00 00 5C E0 38 E0 00 00 00 00

Now I have a Win key (whoopie!).

Nice! Thanks for posting.
 
Back
Top