|
-
September 1st, 2004, 12:18 PM
#1
Command
Hi,
In my application I have a menu item (ID_MENUITEM) that is available on the mainframe menu as well as on the right context menu of a modeless dialog.
I need to know when the menu item gets invoked from the mainframe versus my dialog as I need to different things on each invokation.
Right now - whenever I have my dialog open - the dialog intercepts the WM_COMMAND message even though I am accessing the mainframe menu item.
If I don't have the dialog open; the mainframe command runs fine.
I am not sure what I am missing here.
Thanks,
MD
-
September 1st, 2004, 01:53 PM
#2
Re: Command
Why not change menu id of the dialog context menu item and the mainframe context menu item. Then there would be no way for the two to get confused with each other. Then both would have separate handlers and any common behavior could be done in separate methods which both could call...
Its the same view, doc, and window structure using both menues so off course if the menu items have the same ID value they will end up calling the same message handler associated with that ID.
-
September 1st, 2004, 02:20 PM
#3
Re: Command
 Originally Posted by mddd
Right now - whenever I have my dialog open - the dialog intercepts the WM_COMMAND message even though I am accessing the mainframe menu item.
That is impossible without altering MFC framework message routing, unless you refer to CFormView derived class as modeless dialog.
There are only 10 types of people in the world:
Those who understand binary and those who do not.
-
September 1st, 2004, 02:47 PM
#4
Re: Command
Well.... as JMS says, why not make the IDs different ?
Anyways, if you look at the MSDN, you'd see that WM_COMMAND actually has info as to whether it was invoked from a menu or not. But, thanks to MFC's ON_COMMAND, that info is not available directly.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|