09-10-2003, 02:59 PM
Sorry guys, a real silly question. The context menu I've created for my program icon on the right click of the mouse at the system tray region does not disappear when I hit the escape key or click somewhere on the screen out of the menu. How do I make the menu disappear if I did not want to select anything out of the choices it offers?
09-10-2003, 03:01 PM
Use the SetForegroundWindow API to give focus to your program before displaying the popup.
09-10-2003, 03:02 PM
I have seen this problem with any application that resides in the systray. I think it is a problem with the systray itself. For example, I just right-clicked my NetMeeting icon, and didn't select anything, and it is still down there, with a menu popped up right now. I can't get rid of it until I click something on it.
09-10-2003, 03:10 PM
This only occurs with about 10% of the programs I have. I think some programmers just overlook this issue. Depending on the icon's functionality, sometimes I just remove it from the system tray and make my own. One problem with the system tray that I have found is that sometimes tooltips will appear behind the tray (covered).
09-10-2003, 03:16 PM
One way to make the problem occur is to right-click one icon in your systray, then without leaving the tray or clicking anything else, right-click another icon in the systray. Now both pop-up menus will display and won't go away until an option is clicked. Odd Windows bugs...
09-10-2003, 03:17 PM
What version of Windows are you running? It doesn't happen on my XP or 2000 machines...
09-10-2003, 03:22 PM
Why don't you try searching Microsoft's knowledge base. They may have some information about it. Have fun sifting through all the junk their searcher returns though.
09-10-2003, 04:24 PM
Hey, Photovoltaic, dude! SetForegroundWindow worked for me. Ur D man!
I know what SetForegroundWindow is for but I don't get the logic in this situation. Could you elaborate if you do understand? And where did you learn this quirk. Its quite an arcane trick, isn't it?
Ah! Ah! Ah! Am I forgetting to say thanks, you've done some deep magic to my code. Thanks a zillion.
09-10-2003, 04:51 PM
This was just discussed yesterday:
09-10-2003, 05:29 PM
You guys are just amazing. Thanks a tonne, dude (OnErr0r this time :) )