Friday, June 13, 2014

Defective context menu of running app icon in Win7/8 taskbar

Affected OS

From Windows 7 to Windows 8.1 (with Update)

Symptom

When you right-click on the running app's icon on the Taskbar, it either shows a incomplete menu (only has "Close window") or it shows "Pin to Taskbar" option but it will not do so if you click on it.

Expected behavior

It is OK to reference to Shortcut when the Shortcut file is still available, but why don't Windows reference to the Image File when the Shortcut file is gone? It supposes to be like this:

Causes

If you run an application (bat/exe/cmd) via Shortcut, Windows will reference to the Shortcut instead of the Image aka Target File. Let's say you open a Shortcut named as "Hello Note" that targeted to notepad.exe, you will see "Hello Note" instead of "Notepad" when you right-click on the Notepad's running icon.
If you delete the Shortcut, Windows will try to find the alternative Shortcut in "Start Menu" folder. For instance, deleting "Hello Note" shortcut will cause the name to be shown as "Notepad" instead of showing you an incomplete menu. If Windows failed to do so, symptom as I mentioned just now will happen.

How to reproduce

This bug only happens on applications that do not have Shortcut in "Start Menu" folder, so I recommend you to find a 3rd party and portable app for this. I will use the Hash tool by Robin Keir as example. If you don't have one, download it here : http://keir.net/hash.html

1. Create a Shortcut of Hash.exe to Desktop, then double-click on it.
2. Delete the Shortcut, and then right-click on the Hash's running icon in the Taskbar. You might see an incomplete menu now. If you don't, try the next step.
3. Click on "Pin to Taskbar", and then close the application. You will find out that Hash doesn't really pinned to Taskbar.