We have an application that self-updates using a Laucher.exe process which copies down new App.exe and DLLs from a server then runs them in a separate process.
This was all working very well until the arrival of the Windows 7 taskbar...
Problem is in Windows 7, if the user pins the Launcher.exe to the task bar (by right-clicking the shortcut to Launcher.exe) then this happens... When you start the program the "pinned" taskbar icon momentarily gets focus while the launcher is running but then a totally separate new icon appears when App.exe is running. If the user then decides to right click the icon from the running App.exe and pin that to the taskbar, they bypass the application update part of the process.
Things we've tried to far... We have looked into making the Launcher.exe load the App.exe assembly and run it inside the Launcher.exe process but this has a few other issues… Launcher.exe is .NET 2 I don’t think it will be able to load a .NET 4 set of assemblies when in the future we upgrade the App.exe to .net 4 or .net 5 etc…
We are currently investigating using ApplicationUserModelIDs to help with this but this is a new area for us.. progress is slow...
Any ideas? ... all gratefully recieved.
ApplicationUserModelIDs is what we used in the end, simple solution really and works well.
Squirrel.Windows has some information on how to implement this: https://github.com/Squirrel/Squirrel.Windows/pull/247
I haven't found any good resources for C#, the only samples I've found are C/C++, and the Squirrel.Windows example only 1 of the 3 calls are implemented in C#.
C++ sample:
https://blogs.msdn.microsoft.com/oldnewthing/20110601-00/?p=10523/
来源:https://stackoverflow.com/questions/3829245/launching-a-child-process-and-the-windows-7-taskbar