Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Close popupmenu

130 views
Skip to first unread message

Alain Schlesser

unread,
Sep 9, 2001, 1:52:32 PM9/9/01
to
Could anyone tell me how to close a popmenu displayed with
TrackPopupMenuEx() in code? A new call to TrackPopupMenuEx() is ignored
until the old menu is clicked away by the user!
Thanks,
Alain


Quixote

unread,
Sep 10, 2001, 3:35:01 AM9/10/01
to

"Alain Schlesser" <sal...@pt.lu> wrote in message
news:3b9ba...@news.vo.lu...

SendMessage(hwnd, WM_CANCELMODE, 0, 0);

Note that when a menu is being displayed the program is in a modal loop, so
simply including this SendMessage just after TrackPopupMenuEx() won't do you
any good because the line won't be processed until after you have closed the
menu. You must find another means of sending the message to the program (you
can confirm that WM_CANCELMODE works by sending it when processing a
WM_TIMER message, but this presumably won't be the method of sending
WM_CANCELMODE that you will want to employ in your program).

I don't know what you are trying to accomplish, but you might find it useful
to look at "Creating an Internet Explorer-style Menu Bar on MSDN (in the
introductory section on the Common Controls).


--

Quixote
1. To reply to email address, remove donald.
2. Don't reply to email address (post here instead).


Alain Schlesser

unread,
Sep 10, 2001, 6:42:32 AM9/10/01
to
Thanks, Quixote, that was just what I was looking for.


Nigel Patmore

unread,
Sep 13, 2001, 11:28:56 PM9/13/01
to
I'm new to Win32 programming and I am having the same problem as
Alain. I've managed to get the WM_CANCELMODE message working from a
timer but this is obviously not what I'm after.

i would like to send WM_CANCELMODE when the user clicks anywhere on
the screen other than my popup menu. My application consists of a
system tray icon which causes a pop-up menu to appear when right click
on icon.

It sounds easy but I can't work it out. If somebody could help, it
would be much appreciated.

Thanks.

Quixote

unread,
Sep 14, 2001, 3:14:55 AM9/14/01
to

"Nigel Patmore" <ni...@ecom.co.nz.NOSPAM> wrote in message
news:3ba1788c.81440865@EServer...

> I'm new to Win32 programming and I am having the same problem as
> Alain. I've managed to get the WM_CANCELMODE message working from a
> timer but this is obviously not what I'm after.
>
> i would like to send WM_CANCELMODE when the user clicks anywhere on
> the screen other than my popup menu. My application consists of a
> system tray icon which causes a pop-up menu to appear when right click
> on icon.
>
> It sounds easy but I can't work it out. If somebody could help, it
> would be much appreciated.
>
> Thanks.
>

This is a problem specific to popup menus associated with the system tray
icon. You don't need to send WM_CANCELMODE, you just need to use
TrackPopupMenu in a suitably bizarre way. See MSDN article Q135788, "Menus
for Notification Icons Don't Work Correctly".


--

Quixote
1. To reply to email address, remove donald

0 new messages