Zubair Khan
April 17th, 1999, 09:10 AM
I'm trying to use this macro to update a menu that pops up when the user right click on my tray icon. The Menu is linked to my CDialog derived class and the handler was inserted by ClassWizard. The Dialog recieve MenuInit message before the menu is displayed but does ot call the update code until the user has clicked on the actual item. Whcih is obviously too late. Any ideas whats happening here?
Regards - Zubair
Daniel Levine
April 17th, 1999, 01:25 PM
Hi,
I ran into the same problem you are experiencing when I created a system tray app. What I did was instead of using UPDATE_COMMAND_UI, I handled the enabling/disabling, checking/unchecking etc. in the OnTrayNotification() member of the CSystemTray class (it is available on CodeGuru). In the OnTrayNotification() function, a pointer to the menu is retrieved. I used this pointer in conjunction with the menu modification functions to get the job done.
If you are not using CSystemTray, you can still use the same technique in whatever function handles displaying the menu.
Daniel.
Nath
April 21st, 1999, 01:11 PM
Hi,
I think you can use Windows message : WM_INITMENUPOPUP to enable menu or not..
Nath.