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

WM_MENUSELECT

162 views
Skip to first unread message

Pontus Karlsson

unread,
May 17, 1999, 3:00:00 AM5/17/99
to
>I've successfully loaded and displayed my menu in my main application
window. What I need to do is intercept the >WM_MENUSELECT message and
determine which of the menu items is selected. For example, when the user
clicks the >Edit menu, I need to know that they are selecting the Edit menu
and enable/disable the Undo item.

What I really think you should do is intercept the WM_INITMENUPOPUP message
instead. That message is
there for you to intercept and edit your menu before it get's showed.

// Regards Pontus


James Johnston

unread,
May 18, 1999, 3:00:00 AM5/18/99
to

Pontus Karlsson <ponk...@student.liu.se> wrote in message
news:elSe9tQo#GA....@cppssbbsa02.microsoft.com...
> >James Johnston <johnsto...@usa.net> wrote in message
> news:esiIKrJo#GA....@cppssbbsa02.microsoft.com...
> >Hmmm... How do I know that the user has clicked the Edit menu in the
> WM_INITMENUPOPUP message?
>
> I suggest reading the MSDN documentation about WM_INITMENUPOPUP,
>
> WM_INITMENUPOPUP
> hmenuPopup = (HMENU) wParam; // handle to submenu
> uPos = (UINT) LOWORD(lParam); // submenu item position
> fSystemMenu = (BOOL) HIWORD(lParam); // window menu flag
>
> if (uPos == 1)
> {
> // Edit menu opened, hmenuPopup = handle to submenu.
> }

OOPS i was still thinking like WM_MENUSELECT. This message only gets
triggered when the user clicks a submenu like Edit, right? Not when they
point to and/or click Undo, right?

>
>
> >When you reply, please click here. I'll recieve instant notification
about
> your reply to my newsgroup item.
>
> I'd rather not, when you post to news groups it generaly regarded as bad
> style to post in HTML.
> Especially with alot of pictures and crap, many people pay hard earned
money
> for their internet and downloading
> your message takes alot of time on a modem. Other people can't event
display
> HTML posts.
>
> Please post in plain text in the future.

sorry

>
> I also removed microsoft.public.win32.programmer.kernel because this
thread
> realy doesn't consern kernel
> issues.
>
> >James Johnston
> >E-mail: johnsto...@usa.net
>
> // Regards Pontus
>
>
>

Pontus Karlsson

unread,
May 18, 1999, 3:00:00 AM5/18/99
to
>James Johnston <johnsto...@usa.net> wrote in message
news:esiIKrJo#GA....@cppssbbsa02.microsoft.com...
>Hmmm... How do I know that the user has clicked the Edit menu in the
WM_INITMENUPOPUP message?

I suggest reading the MSDN documentation about WM_INITMENUPOPUP,

WM_INITMENUPOPUP
hmenuPopup = (HMENU) wParam; // handle to submenu
uPos = (UINT) LOWORD(lParam); // submenu item position
fSystemMenu = (BOOL) HIWORD(lParam); // window menu flag

if (uPos == 1)
{
// Edit menu opened, hmenuPopup = handle to submenu.
}

>When you reply, please click here. I'll recieve instant notification about
your reply to my newsgroup item.

I'd rather not, when you post to news groups it generaly regarded as bad
style to post in HTML.
Especially with alot of pictures and crap, many people pay hard earned money
for their internet and downloading
your message takes alot of time on a modem. Other people can't event display
HTML posts.

Please post in plain text in the future.

I also removed microsoft.public.win32.programmer.kernel because this thread

Pontus Karlsson

unread,
May 19, 1999, 3:00:00 AM5/19/99
to

James Johnston <johnsto...@usa.net> wrote in message

news:#$oyRRYo#GA....@cppssbbsa02.microsoft.com...


>
>
> Pontus Karlsson <ponk...@student.liu.se> wrote in message
> news:elSe9tQo#GA....@cppssbbsa02.microsoft.com...

> > >James Johnston <johnsto...@usa.net> wrote in message
> > news:esiIKrJo#GA....@cppssbbsa02.microsoft.com...
> > >Hmmm... How do I know that the user has clicked the Edit menu in the
> > WM_INITMENUPOPUP message?
> >
> > I suggest reading the MSDN documentation about WM_INITMENUPOPUP,
> >
> > WM_INITMENUPOPUP
> > hmenuPopup = (HMENU) wParam; // handle to submenu
> > uPos = (UINT) LOWORD(lParam); // submenu item position
> > fSystemMenu = (BOOL) HIWORD(lParam); // window menu flag
> >
> > if (uPos == 1)
> > {
> > // Edit menu opened, hmenuPopup = handle to submenu.
> > }
>

> OOPS i was still thinking like WM_MENUSELECT. This message only gets
> triggered when the user clicks a submenu like Edit, right? Not when they
> point to and/or click Undo, right?
>

Right, it get's sent *before* a submenu is displayed. That way you can
disable/enable the undo item
or any other item in the menu for that matter. When they point and click on
the undo item and
it's not disabled. You get a WM_COMMAND message.

// Regards Pontus

James Johnston

unread,
May 20, 1999, 3:00:00 AM5/20/99
to
Thanks for your help. I think i understand now.

Pontus Karlsson <ponk...@student.liu.se> wrote in message

news:OYPO2veo#GA...@cppssbbsa02.microsoft.com...

Bob Cochenou

unread,
May 27, 1999, 3:00:00 AM5/27/99
to Pontus Karlsson
Pontus:

Sorry to jump into this thread but we have a similar but different
problem w/ controlling the content of a menu.

We want to be able to enable/disable menu items but not in our own app.
We want to do this to another application like MS Word, Excel, etc.

These apps use the CommandBar object type and I see lots of examples on
how to control these objects if you are instantiating the object.

In our case we are outside of the process and need to get the reference
to the object so that we can manipulate them.

Do you have any ideas on how this can be done.

Thanks,

Bob Cochenour
Comprise Technologies
bobnj...@yours.com

0 new messages