From: xamous on
Hi all,

I'm trying tp dynamically change my menubar on the fly in my
application.
I found the message SHCMBM_SETSUBMENU in MSDN document.
But I'm not sure how to use this API, everything I've tried just
doesn't work.
And I can't find any example about this API in Internet.

Is here anybody have experience of thes API, and can tell me the right
usage of this API?
I'm working on a Windows Mobile 6 Smartphone.

Thanks!

- William
From: r_z_aret on
On Sun, 20 Apr 2008 21:12:21 -0700 (PDT), xamous <xamous(a)gmail.com>
wrote:

>Hi all,
>
>I'm trying tp dynamically change my menubar on the fly in my
>application.
>I found the message SHCMBM_SETSUBMENU in MSDN document.
>But I'm not sure how to use this API, everything I've tried just
>doesn't work.
>And I can't find any example about this API in Internet.

I found this message used in the LISTVIEW sample that came with my
copy of the SDK for Pocket PC 2003.


>
>Is here anybody have experience of thes API, and can tell me the right
>usage of this API?
>I'm working on a Windows Mobile 6 Smartphone.

I use a rather different approach to making changes. First, right
after I call SHCreateMenuBar, I fetch the HWND and HMENU from the
SHMENUBAR structure, and store them for use later. When I want to make
changes later, I can use the stored values to work on the top-level
menu, or get the appropriate value for a sub menu using the method I
described in my 14 Aug 06 contribution to a thread called " Deactivate
menu items in WM5" in microsoft.public.windowsce.embedded.vc. I then
use either the CommandBar_ functions (CommandBar_InsertMenubar, etc.)
or "regular" functions (AppendMenu, etc.).


>
>Thanks!
>
>- William

-----------------------------------------
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
From: xamous on
On 4$B7n(B23$BF|(B, $B>e8a(B4$B;~(B35$BJ,(B, r_z_aret(a)pen_fact.com wrote:
> On Sun, 20 Apr 2008 21:12:21 -0700 (PDT), xamous <xam...(a)gmail.com>
> wrote:
>
> >Hi all,
>
> >I'm trying tp dynamically change my menubar on the fly in my
> >application.
> >I found the message SHCMBM_SETSUBMENU in MSDN document.
> >But I'm not sure how to use this API, everything I've tried just
> >doesn't work.
> >And I can't find any example about this API in Internet.
>
> I found this message used in the LISTVIEW sample that came with my
> copy of the SDK for Pocket PC 2003.
>
>
>
> >Is here anybody have experience of thes API, and can tell me the right
> >usage of this API?
> >I'm working on a Windows Mobile 6 Smartphone.
>
> I use a rather different approach to making changes. First, right
> after I call SHCreateMenuBar, I fetch the HWND and HMENU from the
> SHMENUBAR structure, and store them for use later. When I want to make
> changes later, I can use the stored values to work on the top-level
> menu, or get the appropriate value for a sub menu using the method I
> described in my 14 Aug 06 contribution to a thread called " Deactivate
> menu items in WM5" in microsoft.public.windowsce.embedded.vc. I then
> use either the CommandBar_ functions (CommandBar_InsertMenubar, etc.)
> or "regular" functions (AppendMenu, etc.).
>
>
>
> >Thanks!
>
> >- William
>
> -----------------------------------------
> 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 02116www.penfact.com


Hi Robert,

Thank you for your reply.

I just found another way to make it work.

I defined a set of menubar in my resource file.
When I need to change my menubar, I just simply destroy orginal
menubar with DestroyWindow(), and setup a new SHMENUBARINFO ,with
another resource id, then call SHCreateMenuBar() again to create a
whole new menubar.
It looks working fine.

FYI.

- William