Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Cancel notify menu?

Status
Not open for further replies.

Skute

Programmer
Jul 21, 2003
272
0
0
GB
Hi,

ive got a notify menu for my system tray menu icon. and it works just great, except when i right click the icon, display the menu, then decide i dont want to actually click a menu item.

When the menu is displayed and then i click on another window to try to cancel it, the menu stays open. how can i check for this and cancel the menu?

thanks
 
Please explain in a bit more detail!!!
Probable cause may be(I think so..)
1.Might have stuck somehwre in some loop.
2.Resources are not getting free..
 
basically the menu stays open after i click on another window, the process is as follows:

1) Right click system tray icon
2) Menu pops up
3) You decide that you dont actually want to execute one of the menu items
4) You click on another window, ie explorer, IE, .NET whatever.

5) The menu *should* dissappear, but it doesnt!

Any clues?
 
From MSDN:

"To display a context menu for a notification icon, the current window must be the foreground window before the application calls TrackPopupMenu or TrackPopupMenuEx. Otherwise, the menu will not disappear when the user clicks outside of the menu or the window that created the menu (if it is visible)."

But the thing is, the window is minimised and then hidden. Then the icon is displayed. So how can i get around this?

 
ive found a piece of code which has shown me the answer. make the following function call before TrackPopupMenuEx():

SetForegroundWindow(hwnd);

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top