0

In my application I have context menu which is associated with tray icon of the application, when user click on About menu item, it display the message box. Message box is still visible, user right click again on tray icon, menu pop up, user click somewhere else than context menu should disappear, but it didn't, it is still displayed.

Sharique
  • 4,199
  • 6
  • 36
  • 54

2 Answers2

0

You could use SendKeys.Send("{ESC}"); in the trigger event when the user clicks somewhere else.

Darren Young
  • 10,972
  • 36
  • 91
  • 150
  • There is no lost focus event for context menu, so I added it at mouse leave event. If I use send keys function, it also closes the message box. so user is unable to see the message box. – Sharique Feb 01 '11 at 11:49
  • Yeah, this is very bad solution for a number of reasons. You've already seen two of them. – Cody Gray - on strike Feb 01 '11 at 11:56
0

That's a bug. Probably in Windows, the MSDN Library documentation for TrackPopupMenu documents a very similar problem. I don't see an obvious workaround, other than avoiding using MessageBox. Create a little form to be your About box. Display it with the Show() method.

Hans Passant
  • 922,412
  • 146
  • 1,693
  • 2,536