Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

New instance on Taskbar middle-click / shift+click

In Windows 7, some programs allow the user to launch multiple instances by middle clicking / shift+clicking on the taskbar item (ex: Paint, Notepad, Visual Studio...)

However, none of the applications I create exhibit this behavior. The middle click function will make the button glow, but fail to open another instance unless I pin the program to the taskbar first (which is not required for Paint/Notepad/etc to still be able to open new instances)

What is the secret to allowing a WPF application to properly create new instances like the above listed programs?

I've tried searching, but I have only come up with jumplist/tasks or single-instance program results.

like image 368
Sharpy Avatar asked Jul 24 '11 04:07

Sharpy


1 Answers

The secret here is called shortcut. To get this behavior, you have to create a shortcut to your program, to the start menu, the desktop or the taskbar. When a shortcut is present, Windows finds it from the running program, even if it has been started by a totally different way (command line, explorer, etc...) and middle clicking or shift-clicking on the open program icon in the taskbar simply executes the shortcut.

This is easily verifiable: remove the shortcut for Notepad from the start menu and you won't be able to middle click it anymore! Change the shortcut by adding an argument to it (a text file path) and the file will be opened in notepad by shift-clicking on the taskbar icon.

like image 139
Julien Lebosquain Avatar answered Sep 19 '22 13:09

Julien Lebosquain