Hello,

I have a dialog box with a menu that I dynamically add Menu items to the
menu. I also assign consecutive commands to this menu list. However, I'm
not sure how to intercept menu user events in single function with the
command id passed as parameter. I can not use ON_COMMAND since i do not know
how many menu items i will append.

Is there an easy way to do that.

Thanks

Re: Intercepting Range of Menu Commands by Scott

Scott
Sun Sep 17 20:02:47 CDT 2006

"Sam" <Sam@nospam.com> wrote:
>I have a dialog box with a menu that I dynamically add Menu items to the
>menu. I also assign consecutive commands to this menu list. However, I'm
>not sure how to intercept menu user events in single function with the
>command id passed as parameter. I can not use ON_COMMAND since i do not know
>how many menu items i will append.

What programming language are you using?

--
--------- Scott Seligman <scott at <firstname> and michelle dot net> ---------
He had to get up to run some more. He told his muscles to do so. They
told him they had the night off.
-- Deadly Relations: Bester Ascendant by J. Gregory Keyes

Re: Intercepting Range of Menu Commands by Sam

Sam
Mon Sep 18 09:05:21 CDT 2006

MFC evc++ 4.0

THanks

"Scott Seligman" <seligman@example.com> wrote in message
news:eekr7n$3b3$1@panix3.panix.com...
> "Sam" <Sam@nospam.com> wrote:
>>I have a dialog box with a menu that I dynamically add Menu items to the
>>menu. I also assign consecutive commands to this menu list. However, I'm
>>not sure how to intercept menu user events in single function with the
>>command id passed as parameter. I can not use ON_COMMAND since i do not
>>know
>>how many menu items i will append.
>
> What programming language are you using?
>
> --
> --------- Scott Seligman <scott at <firstname> and michelle dot
> net> ---------
> He had to get up to run some more. He told his muscles to do so. They
> told him they had the night off.
> -- Deadly Relations: Bester Ascendant by J. Gregory Keyes



Re: Intercepting Range of Menu Commands by r_z_aret

r_z_aret
Mon Sep 18 16:44:06 CDT 2006

On Sun, 17 Sep 2006 08:37:54 GMT, "Sam" <Sam@nospam.com> wrote:

>Hello,
>
>I have a dialog box with a menu that I dynamically add Menu items to the
>menu. I also assign consecutive commands to this menu list. However, I'm
>not sure how to intercept menu user events in single function with the
>command id passed as parameter. I can not use ON_COMMAND since i do not know

I assume ON_COMMAND is a function that handles WM_COMMAND messages. If
so, then the low word of the corresponding WPARAM will contain the
control id associated with the menu item. Use LOWORD to extract it. If
each menu item has a different control id, then you can use a switch
statement or "if" block to match the right code for each one. If the
items are unique across menus, you don't even need to know which menu
an item is in.


>how many menu items i will append.

Shouldn't matter.


>
>Is there an easy way to do that.
>
>Thanks
>

-----------------------------------------
To reply to me, remove the underscores (_) from my email address (and please indicate which newsgroup and message).

Robert E. Zaret, eMVP
PenFact, Inc.
20 Park Plaza, Suite 478
Boston, MA 02116
www.penfact.com

Re: Intercepting Range of Menu Commands by Scott

Scott
Mon Sep 18 16:04:53 CDT 2006

"Sam" <Sam@nospam.com> wrote:
>MFC evc++ 4.0
>
>THanks

For MFC, instead of using the ON_COMMAND macro, try
using the ON_COMMAND_RANGE macro to specify a range
of IDs that you want to intercept.

--
--------- Scott Seligman <scott at <firstname> and michelle dot net> ---------
He had to get up to run some more. He told his muscles to do so. They
told him they had the night off.
-- Deadly Relations: Bester Ascendant by J. Gregory Keyes

Re: Intercepting Range of Menu Commands by Sam

Sam
Tue Sep 19 07:10:57 CDT 2006

Thanks! that worked.


"Scott Seligman" <seligman@example.com> wrote in message
news:een1ll$49q$1@panix3.panix.com...
> "Sam" <Sam@nospam.com> wrote:
>>MFC evc++ 4.0
>>
>>THanks
>
> For MFC, instead of using the ON_COMMAND macro, try
> using the ON_COMMAND_RANGE macro to specify a range
> of IDs that you want to intercept.
>
> --
> --------- Scott Seligman <scott at <firstname> and michelle dot
> net> ---------
> He had to get up to run some more. He told his muscles to do so. They
> told him they had the night off.
> -- Deadly Relations: Bester Ascendant by J. Gregory Keyes



Re: Intercepting Range of Menu Commands by r_z_aret

r_z_aret
Tue Sep 19 15:23:16 CDT 2006

On Mon, 18 Sep 2006 16:44:06 -0500, r_z_aret@pen_fact.com wrote:

>On Sun, 17 Sep 2006 08:37:54 GMT, "Sam" <Sam@nospam.com> wrote:
>
>>Hello,
>>
>>I have a dialog box with a menu that I dynamically add Menu items to the
>>menu. I also assign consecutive commands to this menu list. However, I'm
>>not sure how to intercept menu user events in single function with the
>>command id passed as parameter. I can not use ON_COMMAND since i do not know
>
>I assume ON_COMMAND is a function that handles WM_COMMAND messages. If

From Scott Seligman's contribution I gather this is a bad assumption.
Sigh.


>so, then the low word of the corresponding WPARAM will contain the
>control id associated with the menu item. Use LOWORD to extract it. If
>each menu item has a different control id, then you can use a switch
>statement or "if" block to match the right code for each one. If the
>items are unique across menus, you don't even need to know which menu
>an item is in.
>
>
>>how many menu items i will append.
>
>Shouldn't matter.
>
>
>>
>>Is there an easy way to do that.
>>
>>Thanks
>>
>
>-----------------------------------------
>To reply to me, remove the underscores (_) from my email address (and please indicate which newsgroup and message).
>
>Robert E. Zaret, eMVP
>PenFact, Inc.
>20 Park Plaza, Suite 478
>Boston, MA 02116
>www.penfact.com

-----------------------------------------
To reply to me, remove the underscores (_) from my email address (and please indicate which newsgroup and message).

Robert E. Zaret, eMVP
PenFact, Inc.
20 Park Plaza, Suite 478
Boston, MA 02116
www.penfact.com