Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

XP Pro - Using Keyboard Shortcuts sometimes hangs ~20 secs 2

Status
Not open for further replies.

humbletech99

Programmer
Nov 22, 2005
155
GB
When using keyboard shortcuts to open programs via the shortcut key that you can set on a .lnk to that program, I find that my workstation can sometimes hang for around 15-20 seconds.

Most of the time, the shortcuts work fine, but then every now and again using one will just cause everything to block and hang, everything you do in the next 20 seconds doesn't materialize on the computer until that original action is unblocked and then everything races through a catch up, like a sudden gush of released water....

Anyone know how to fix this behaviour to not block/freeze the desktop?
 
It's an issue with explorer -- I'm almost shure now. It's not just a bug as several versions of Windows affected, it's some kind of ideological flaw. ,)
 
Probably I am wandering a bit off course but I was using the On-Screen Keyboard to launch the Shortcut I created. It took 3 Mouse clicks, Ctrl, Alt, and N. No letters were dimmed.


The more programs you have open may be causing longer delays while Windows is perhaps checking out the following?

"A keyboard shortcut does not work if it conflicts with a keyboard combination that is used in the program that is currently active".

Also, any keyboard shortcuts created, must reside on the desktop.


How to create a keyboard shortcut for a program in Windows XP

Have you looked at something like Process Monitor to tell you what might be happening behind the scene during the hang?

Process Monitor v1.31
 
There's no CPU load at that time -- just takbar is not responding, sometimes applications respond slower (most of the times I would say), ALT-TAB is working OK, but apps need a time to maximize.
 
I suggested something like Process Monitor to see if it is perhaps looping through several pieces of code or keys in the Registry.

Does this bug occur in Safe Mode, or in Normal Mode but with a different user?
 
@linney

Strange - your on-screen keyboard works different from mine - maybe a thing of different Windows language (I am a German user)?

The hang time is always the same, independend of current program activity, and it does not cause any additional system load. The system load in task manager can be at 0% and the explorer is still hanging the same way.

"Also, any keyboard shortcuts created, must reside on the desktop."

Uh, sure? Most of my shortcuts are not on the desktop, but within the start menu.
 
You are correct. A copy and paste error on my part, but the linked MSKB had the correct information.

"This article describes how to create a keyboard shortcut for a program in Windows XP. Note that this feature works only with program shortcuts on the desktop or the Start menu. This feature does not work if the desktop shortcut is a shortcut to another shortcut".

How to create a keyboard shortcut for a program in Windows XP

Maybe someone like "BadBigBen" or other German users might see this thread and check their On-Screen keyboard, or easier still you could try it out on a friend's machine.
 
?pmandrella,

I've used both russian and english version of Windows (but with russian locale installed for english versions). Right now I'm on WinXP-x64-Eng with russian locale support added.
 
Meanwhile, I have solved the problem by writing a little tool wich does the same job and has no hanging problems. It basically goes like this:


#include <windows.h>

int WINAPI WinMain(
HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
MSG msg;
STARTUPINFO si;
PROCESS_INFORMATION pi;

ZeroMemory(&si,sizeof(si));
si.cb = sizeof(si);

RegisterHotKey(NULL,'K',MOD_ALT|MOD_CONTROL,'K');
RegisterHotKey(NULL,'U',MOD_ALT|MOD_CONTROL,'U');
// ... and so on ...

while (GetMessage(&msg,NULL,0,0))
if (!TranslateMessage(&msg))
if (msg.message == WM_HOTKEY)
switch (msg.wParam)
{
case 'K': CreateProcess("d:\\windows\\system32\\cmd.exe","",NULL,NULL,FALSE,0,NULL,NULL,&si,&pi);
break;
case 'U': CreateProcess("d:\\app\\editors\\ue\\uedit32.exe","",NULL,NULL,FALSE,0,NULL,NULL,&si,&pi);
break;
// .. and so on ...
}

return 0;
}


This can be refined by using a configuration file instead of hard-coding the keys and executables, and by running programs indirectly via "cmd.exe /c" so that it also works for executing batch and .lnk files.

Hard to believe that Microsoft did not manage to build such a simple thing without flaws into its Windows desktop.
 
Meanwhile, I noticed the the this my first approach does not handle well pressing a hotkey for a program which was already started. But Windows also does not handle that case very well. Depending on the program, it will either

- bring in front the window of the already running program
- run a second instance of the program, or
- remove focus from the foreground application, but do nothing else (for example when using a shortcut for calc.exe; this has been annoying me for years!)

I managed now to incorporate this in my self-made tool in a manner wich works much better than the Windows explorer, because it consistently does what I want: As configured for each shortcut, it will either run a second instance for an already running program, or it will with EVERY program bring the already opened window in front.

I have accomplished this by storing the process ID of started programs while they are running, and in case the same hotkey is pressed again, finding a visible window of the program and SetForegroundWindow() it. (It looks like the Windows explorer just tries to activate the toplevel window in this case, which will not work if it is invisible! There are actually lots of applications out there which use an always invisible toplevel window, for example Internet Explorer or UltraEdit).


I still cannot believe how poor Miscrosoft did implement this feature. It took me just a few hours to build something much more usable from scratch.

If anyone of you is interested, let me know your email address and I will send you the new shortcut tool.
 
One funny issue has been left which I am not able to resolve:

Some time ago, I assigned an AltGr+I shortcut to the Internet Explorer icon on the desktop. This was possible with Windows XP and IE6.

Recently I upgraded to IE7. Now, the AltGr+I shortcut is still active, but there is no more way to access the shortcut setting for the IE dekstop icon. Selecting properties will bring up the IE configuration dialog. I even did a system restore to my IE6 installation, but this did not bring back the old properties dialog including the keyboard shortcut setting. Obviously the IE7 did some permanent change regarding the IE dekstop icon which cannot be undone.

Disabling the IE icon on the dekstop does not work either. The AltGr+I keyboard shortcut has been stored away somewhere in the registry, and I am not able to reassing this key now to my own shorcut tool. If you have any idea where Windows stores this information, please let me know!
 
If you right-click on your IE7 Icon, do you have the option in the drop down menu to create a shortcut? If you do, and are able to create a shortcut, does the new shortcut have any option (or mention) to change the shortcut key?

What happens if you reset IE7 back to defaults, does any shortcut still work?
 
linney, I appreciate that you are trying to help me with this problem, but again: your questions don't make sense.

Exlorer will never duplicate hotkey settings when duplicating a shortcut, because it knows what you already stated above: One hotkey may be assigned only once.

And the hotkey setting cannot be stored within the Internet Explorer settings, because that would require IE to be already running to process the shortcut key. A programm cannot start itself, but it must be started by another program. The hotkey must be stored in the Windows Explorer settings. (When I kill the explorer.exe in the task manager, all the hotkeys are gone, including my AltGr+I Internet Explorer hotkey. When I run explorer.exe again from task manager, the hotkey is back).

Before doing such "blind shots", please first try to track down the problem logically and consider what may be a solution and what CANNOT be!
 
I was asking if, when you look at the IE7 Shortcut (you create) is there an entry in the Shortcut Key box? And if there is, can you change it or remove it from there?

Have you tried Process Monitor to see if you can track down what happens when you create a shortcut key?

Process Monitor v1.31
 
Hi pmandrella

pmandrella (Programmer)> If anyone of you is interested, let me know your email address and I will send you the new shortcut tool.

YES! I can dublicate this error every day for the last 1-2 years in WinXP explorer and on Vista explorer. Hang app. 20 secs. JUST WAITING!

Please mail me your workaround on tho at scanvaegt dk

Terkild (Programmer)
 
Just a link to another bit of information.

Obscure XP Shortcut key performance problem
thread779-1504799
 
Thanks, linney for pointing to my post elsewhere - For some reason I hadn't thought anyone else noticed this.

For those not wanting to flip to other thread: -- and I am trying NOT to repeat what I said there, but net it out and add some more information. ;-)

I think the answer is (1) design oversight in XP; and (2) DISK CACHE.

Good Design no one @ MS thought of: Run through the start menu at startup and CACHE the shortcuts and their targets. Results: Quick (uhh, "short") cuts.

Oversight: start at the root of the start menu (in the file system of course) and OPEN EVERY LINK and read byte 65 (key) and 66 (control/alt mods) and see if that is the one you hit.

I have over 400 files in start menu "tree" (I wrote a program to create a file of them AND expand the shortcuts) so on the average, Windows is opening two hundred files (and reading them and closing them) to find the shortcut!

Your disk cache can cache these small files if you use the shortcuts frequently (or use one that was already cached in looking for another)... but heavy computer usage causes your cache to be flushed and it has to re-read your start menu again!

 
I wrote my own superfast little C# program using

hotKey.HotKeyPressed += new HotKeyPressedEventHandler( hotKey_Pressed );

Mail me if details. Se my address in prior post.
 
If any of you who have come up with software solutions are still following this thread, it would be handy if someone can post a file, or where it can be found. I'm sure there will be others after me who would find it useful.
 
Maybe it is in this cryptic e-mail address?

tho at scanvaegt dk
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top