-
Hi,
I'm runnung a vb project, a small icon sits on the system tray and when i click it a menu appears. To do so, i've a module and a code in the MouseDown event of the Form1 that goes:
<code>
Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If (X + Y ^ 16) = WM_RBUTTONDOWN Then
Form1.PopupMenu mnuPopUp_0 'The menu
End If
End Sub
</code>
Everything works fine, BUT... when i click OUTSIDE the menu, the menu doesn't disappear...!!! I want that if i click on the taskbar, for example, the menu GOES AWAY!
How can i do that? I tried a Form1.refresh but doesn't work as the taskbar is not SCALED in the form...
HEEEEEEEEEEEEEEEEEEEEELPP!!
W.
-
HEy
If you havent figured it out yet then I will send you my project later so you can have a look at mine..
Matt
-
no i haven't figured it out, as apparently it is a windows bug... in c++ is easy: one must set the current window as the foreground window before calling TrackPopupMenu. This then causes a second problem - namely that the next time the menu is displayed it displays then immediately disappears. To fix this problem, you must make the currernt application active after the menu disappears. This can be done by sending a benign message such as WM_NULL to the current window.
BUT HOW DO I DO THIS IN VB... that's the issue.