How to release Popup Menu from system tray? 
Author Message
 How to release Popup Menu from system tray?

Ref VB6

I have created a popup menu from the system tray icon. Having problems in
can't seem to find a way to release the popup menu if no menu items were
selected. In another words, when I do a right mouse click from my icon the
popup menu pops up showing the menu items, but I decide not to select any of
the menu items, I can seem to make the popup menu go away, only if I have
selected a menu item it does this.

Appreciate any help you can give me.

Thanks again,
JT



Mon, 13 Oct 2003 05:10:57 GMT  
 How to release Popup Menu from system tray?
I suppose the popup-menu is from a hidden form? (haven't done it before).
Can you use the Form_Deactivate event?

Johan.



| Ref VB6
|
| I have created a popup menu from the system tray icon. Having problems in
| can't seem to find a way to release the popup menu if no menu items were
| selected. In another words, when I do a right mouse click from my icon the
| popup menu pops up showing the menu items, but I decide not to select any
of
| the menu items, I can seem to make the popup menu go away, only if I have
| selected a menu item it does this.
|
| Appreciate any help you can give me.
|
| Thanks again,
| JT
|
|
|
|



Mon, 13 Oct 2003 18:57:57 GMT  
 How to release Popup Menu from system tray?
How did you write the code?

Whenever the mouse moves over or clicks the tray icon, Form_MouseMove
triggers and the X variable is one of the following:
Const WM_MOUSEMOVE = &H200
Const WM_LBUTTONDOWN = &H201
Const WM_LBUTTONUP = &H202
Const WM_LBUTTONDBLCLK = &H203
Const WM_RBUTTONDOWN = &H204
Const WM_RBUTTONUP = &H205
Const WM_RBUTTONDBLCLK = &H206
Const WM_MBUTTONDOWN = &H207
Const WM_MBUTTONUP = &H208
Const WM_MBUTTONDBLCLK = &H209
(Any other value means mouse moving over the form, not the icon)
You can check if X = WM_RBUTTONDOWN and then use PopUpMenu.

If this is how you did it, then it should work.
The problem might also be in the Windows version. Is it 95/98 or 2000? I use
98 and it works fine, but I've read something in MSDN about 2000 having a
slightly different approach for the Shell_NotifyIcon function. But I don't
think that's it, it should also work for Windows 2000.

Quote:
> Ref VB6

> I have created a popup menu from the system tray icon. Having problems in
> can't seem to find a way to release the popup menu if no menu items were
> selected. In another words, when I do a right mouse click from my icon the
> popup menu pops up showing the menu items, but I decide not to select any
of
> the menu items, I can seem to make the popup menu go away, only if I have
> selected a menu item it does this.

> Appreciate any help you can give me.

> Thanks again,
> JT



Tue, 14 Oct 2003 01:52:47 GMT  
 How to release Popup Menu from system tray?
On Thu, 26 Apr 2001 17:52:47 GMT, "Freak"

Yes, show us the code.  The system should take care of hiding the
popupmenu, once you click away from it.
If you just popup on mousemove and not on an actual button event you
may have a cascading event ?

Quote:
>How did you write the code?

>Whenever the mouse moves over or clicks the tray icon, Form_MouseMove
>triggers and the X variable is one of the following:
>Const WM_MOUSEMOVE = &H200
>Const WM_LBUTTONDOWN = &H201
>Const WM_LBUTTONUP = &H202
>Const WM_LBUTTONDBLCLK = &H203
>Const WM_RBUTTONDOWN = &H204
>Const WM_RBUTTONUP = &H205
>Const WM_RBUTTONDBLCLK = &H206
>Const WM_MBUTTONDOWN = &H207
>Const WM_MBUTTONUP = &H208
>Const WM_MBUTTONDBLCLK = &H209
>(Any other value means mouse moving over the form, not the icon)
>You can check if X = WM_RBUTTONDOWN and then use PopUpMenu.

>If this is how you did it, then it should work.
>The problem might also be in the Windows version. Is it 95/98 or 2000? I use
>98 and it works fine, but I've read something in MSDN about 2000 having a
>slightly different approach for the Shell_NotifyIcon function. But I don't
>think that's it, it should also work for Windows 2000.

>> Ref VB6

>> I have created a popup menu from the system tray icon. Having problems in
>> can't seem to find a way to release the popup menu if no menu items were
>> selected. In another words, when I do a right mouse click from my icon the
>> popup menu pops up showing the menu items, but I decide not to select any
>of
>> the menu items, I can seem to make the popup menu go away, only if I have
>> selected a menu item it does this.

>> Appreciate any help you can give me.

>> Thanks again,
>> JT

Regards, Frank.


Tue, 14 Oct 2003 05:47:45 GMT  
 How to release Popup Menu from system tray?
One solution is to make the VB app the foreground window before calling the
menu in the window procedure as in

            Case WM_RBUTTONUP
                ' Need to set the foreground window as the menu wont drop if
we dont!
                Debug.Print "Current Foreground: " & GetForegroundWindow()
      >>>>SetForegroundWindow frmIcon.hWnd
                'show pop-up menu
                frmIcon.PopupMenu frmIcon.mnuNeverSeen,
vbPopupMenuRightAlign
                '
where frmIcon is the parent form in my application and mnuNeverSeen is the
top level menu in the project that the popup window is a cild of.

api declarations are
Public Declare Function SetForegroundWindow Lib "user32" (ByVal hWnd As
Long) As Long
Public Declare Function GetForegroundWindow Lib "user32" () As Long

Regards
Steve

Quote:

>Ref VB6

>I have created a popup menu from the system tray icon. Having problems in
>can't seem to find a way to release the popup menu if no menu items were
>selected. In another words, when I do a right mouse click from my icon the
>popup menu pops up showing the menu items, but I decide not to select any
of
>the menu items, I can seem to make the popup menu go away, only if I have
>selected a menu item it does this.

>Appreciate any help you can give me.

>Thanks again,
>JT



Tue, 21 Oct 2003 16:37:23 GMT  
 How to release Popup Menu from system tray?
Thanks Steve!

The explanation and example worked great!

-JT


Quote:
> One solution is to make the VB app the foreground window before calling
the
> menu in the window procedure as in

>             Case WM_RBUTTONUP
>                 ' Need to set the foreground window as the menu wont drop
if
> we dont!
>                 Debug.Print "Current Foreground: " & GetForegroundWindow()
>       >>>>SetForegroundWindow frmIcon.hWnd
>                 'show pop-up menu
>                 frmIcon.PopupMenu frmIcon.mnuNeverSeen,
> vbPopupMenuRightAlign
>                 '
> where frmIcon is the parent form in my application and mnuNeverSeen is the
> top level menu in the project that the popup window is a cild of.

> api declarations are
> Public Declare Function SetForegroundWindow Lib "user32" (ByVal hWnd As
> Long) As Long
> Public Declare Function GetForegroundWindow Lib "user32" () As Long

> Regards
> Steve


> >Ref VB6

> >I have created a popup menu from the system tray icon. Having problems in
> >can't seem to find a way to release the popup menu if no menu items were
> >selected. In another words, when I do a right mouse click from my icon
the
> >popup menu pops up showing the menu items, but I decide not to select any
> of
> >the menu items, I can seem to make the popup menu go away, only if I have
> >selected a menu item it does this.

> >Appreciate any help you can give me.

> >Thanks again,
> >JT



Tue, 25 Nov 2003 17:00:56 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. TaskIcon.OCX for show icon and popup menu in system tray

2. System Tray icon with popup menus

3. Popup menu on system Tray Icon

4. Popup Menu in System Tray

5. popup menu in system tray

6. Popup menu in System tray

7. System Tray Popup Menu fails Under Win95 (Q176085)

8. How to kill a Popup Menu in the System Tray

9. accelerator keys for system tray popup menu not working

10. hide system tray popup menu

11. Popup Menu in System Tray

12. Windows 95 System Menu and PopUp Menus PROBLEM

 

 
Powered by phpBB® Forum Software