Click to See Complete Forum and Search --> : Clicking a systray icon without focusing taskbar


chrishowarth
March 20th, 2008, 08:25 AM
I have a program which runs as an icon in the system tray. When its icon is left-clicked, the window currently in focus is hidden and can be restored later. However, when I click the icon the taskbar (as explorer.exe) is focused, causing it to disappear and I have to start it again from the task manager.

How could I stop this from happening? is there a way to get the window that was in focus before the taskbar?

Martin O
March 20th, 2008, 12:05 PM
Maybe GetForegroundWindow().

Igor Vartanov
March 21st, 2008, 06:12 AM
However, when I click the icon the taskbar (as explorer.exe) is focused, causing it to disappear and I have to start it again from the task manager.Please elaborate this: who from that "it"s gets disappeared and who has to be started from the task manager? BTW, the code snippet of handling your tray icon messages would be really good. And the sample project that imitates the problem would be the best. ;)