C++: Minimize to tray and restore window w/double click.

DannyBoy

Diamond Member
Nov 27, 2002
8,820
2
81
www.danj.me
Ok, ive posted on a few other forums, but have had piss poor support from them.

Seeing as ive had great support from Anandtech forums as usual, im now gunna ask you guys.
Im hesitant to ask for more help, because its making me feel like a pain in the arse.

Basically I have my main program kyxcaster, and i want to be able to select the menu item
i have defined in resources as "ID_HIDETRAY", and hide the program into the tray, if that makes sense...

I have no idea how to do this and hope someone can help out.

My program is NOT MFC, it is a bare win32 API exe.

As always, thanks in advance :)

Dan :)
 

DaveSimmons

Elite Member
Aug 12, 2001
40,730
670
126
My first thought is to PostMessage() yourself whatever message the minimize button sends, either in the handler for ID_HIDETRAY or by changing the menu item's command directly to it.

If you have petzold or do some searching on "minimize" (adding "win32" if too many search results) you hopefully can find the command ID.

ShowWindow ( **hwnd goes here** , SW_SHOWMINIMIZED ) will minimize a window, you could try putting it in a handler for ID_HIDETRAY.