问题
We have an application that has a "launcher" app that sits there with a pretty UI while the main app loads in the background. Both of these apps are written in VB6 (sigh).
In Windows 7, if user's pin the launcher program, we get two different icons on the taskbar (one for the main app, and then the pinned icon for the launcher program). This looks very odd.
I've tried using the following function: http://msdn.microsoft.com/en-us/library/dd378422%28VS.85%29.aspx to no avail so far.
I gave both the same name (Company.Product), as advised in the documentation, and before any UI pops up. If I pin the launcher app while it is running, this works fine. If I pin the executable for the launcher, I get two icons.
Any ideas on how to fix it such that I can users could just pin the launcher exe and all is good?
回答1:
Why have two separate executables (particularly when they are written in the same language). Why not merge the launcher in with the "main application" and do some threading to have the main app actually start while the launcher is displaying a title screen, etc. There are number of tutorials for creating launchers.
回答2:
Make it so your main app doesn't show up in the taskbar and make it so when launcher is clicked in the taskbar it will send a message to the main window to appear if it is minimized. This can be achieved with Windows API.
Use FindWindowEx to get a handle for the main window then send a WM_SYSCOMMAND message with SC_RESTORE.
来源:https://stackoverflow.com/questions/1917144/windows-7-vb6-launcher-app-and-pinning-to-the-taskbar