| |||||||
| Smartphones This is the Microsoft General Public Smartphones Newsgroup. |
![]() |
| | LinkBack | Thread Tools |
| |||
| Dynamically replace menu toolbar I would like to replace the toolbar with another toolbar from my resources using the Windows. My attempt so far involves: 1. Calling SHCreateMenuBar when the application is initialized to load a toolbar from my resources. 2. Calling CommandBar_Destroy + SHCreateMenuBar to change it to another toolbar. This does not work; the Windows start menu toolbar is displayed instead even though SHCreateMenuBar does not indicate an error. What am I doing wrong? Regards, Johannes |
| |||
| Re: Dynamically replace menu toolbar On Mon, 6 Aug 2007 02:24:04 -0700, Johannes <Johannes@discussions.microsoft.com> wrote: >I would like to replace the toolbar with another toolbar from my resources >using the Windows. > >My attempt so far involves: > >1. Calling SHCreateMenuBar when the application is initialized to load a >toolbar from my resources. This is the right function to use when creating a menu for a Windows Mobile application > >2. Calling CommandBar_Destroy + SHCreateMenuBar to change it to another >toolbar. This does not work; the Windows start menu toolbar is displayed >instead even though SHCreateMenuBar does not indicate an error. I don't see any reason to call CommandBar_Destroy. What is "it" in the phrase "change it to another toolbar"? How are you checking SHCreateMenuBar for errors? Are you trying to change the toolbar/menu for you app, or for the whole device? > >What am I doing wrong? > >Regards, > >Johannes ----------------------------------------- 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: Dynamically replace menu toolbar See below. "r_z_aret@pen_fact.com" wrote: > On Mon, 6 Aug 2007 02:24:04 -0700, Johannes > <Johannes@discussions.microsoft.com> wrote: > > >I would like to replace the toolbar with another toolbar from my resources > >using the Windows. > > > >My attempt so far involves: > > > >1. Calling SHCreateMenuBar when the application is initialized to load a > >toolbar from my resources. > > This is the right function to use when creating a menu for a Windows > Mobile application > > > > > >2. Calling CommandBar_Destroy + SHCreateMenuBar to change it to another > >toolbar. This does not work; the Windows start menu toolbar is displayed > >instead even though SHCreateMenuBar does not indicate an error. > > I don't see any reason to call CommandBar_Destroy. What is "it" in the > phrase "change it to another toolbar"? How are you checking > SHCreateMenuBar for errors? I check both the return of SHCreateMenuBar and IsWindow(hwndMB). > Are you trying to change the toolbar/menu for you app, or for the > whole device? I want to change the menu toolbar for my application. > > > > >What am I doing wrong? > > > >Regards, > > > >Johannes > > ----------------------------------------- > 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: Dynamically replace menu toolbar On Mon, 6 Aug 2007 23:46:00 -0700, Johannes <Johannes@discussions.microsoft.com> wrote: >See below. > >"r_z_aret@pen_fact.com" wrote: > >> On Mon, 6 Aug 2007 02:24:04 -0700, Johannes >> <Johannes@discussions.microsoft.com> wrote: >> >> >I would like to replace the toolbar with another toolbar from my resources >> >using the Windows. >> > >> >My attempt so far involves: >> > >> >1. Calling SHCreateMenuBar when the application is initialized to load a >> >toolbar from my resources. >> >> This is the right function to use when creating a menu for a Windows >> Mobile application >> >> >> > >> >2. Calling CommandBar_Destroy + SHCreateMenuBar to change it to another >> >toolbar. This does not work; the Windows start menu toolbar is displayed >> >instead even though SHCreateMenuBar does not indicate an error. >> >> I don't see any reason to call CommandBar_Destroy. What is "it" in the >> phrase "change it to another toolbar"? How are you checking >> SHCreateMenuBar for errors? > >I check both the return of SHCreateMenuBar and IsWindow(hwndMB). Try calling GetLastError message when SHCreateMenuBar fails, and then use Tools->Error Lookup to interpret the error code from GetLastError. If you don't understand the explanation (likely, because they _are_ cryptic), report it here and someone will likely provide a more understandable interpretation. > >> Are you trying to change the toolbar/menu for you app, or for the >> whole device? > >I want to change the menu toolbar for my application. Do you really want to change the toolbar while your application is running? Or just modify it? I'm not at all sure you can change it. I know you can modify (add, remove, change captions) an existing toolbar. I think if you step back a bit and explain why you think you need to change the toolbar, one of us will have a better idea how to help. For example, tell us what you want the user to see. > >> >> > >> >What am I doing wrong? >> > >> >Regards, >> > >> >Johannes >> >> ----------------------------------------- >> 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 |
| |||
| Re: Dynamically replace menu toolbar "r_z_aret@pen_fact.com" wrote: > On Mon, 6 Aug 2007 23:46:00 -0700, Johannes > <Johannes@discussions.microsoft.com> wrote: > > >See below. > > > >"r_z_aret@pen_fact.com" wrote: > > > >> On Mon, 6 Aug 2007 02:24:04 -0700, Johannes > >> <Johannes@discussions.microsoft.com> wrote: > >> > >> >I would like to replace the toolbar with another toolbar from my resources > >> >using the Windows. > >> > > >> >My attempt so far involves: > >> > > >> >1. Calling SHCreateMenuBar when the application is initialized to load a > >> >toolbar from my resources. > >> > >> This is the right function to use when creating a menu for a Windows > >> Mobile application > >> > >> > >> > > >> >2. Calling CommandBar_Destroy + SHCreateMenuBar to change it to another > >> >toolbar. This does not work; the Windows start menu toolbar is displayed > >> >instead even though SHCreateMenuBar does not indicate an error. > >> > >> I don't see any reason to call CommandBar_Destroy. What is "it" in the > >> phrase "change it to another toolbar"? How are you checking > >> SHCreateMenuBar for errors? > > > >I check both the return of SHCreateMenuBar and IsWindow(hwndMB). > > Try calling GetLastError message when SHCreateMenuBar fails, and then > use Tools->Error Lookup to interpret the error code from GetLastError. > If you don't understand the explanation (likely, because they _are_ > cryptic), report it here and someone will likely provide a more > understandable interpretation. You seem to have misunderstood me. It does not give any error message, SHCreateMenuBar and IsWindow returns true. The menu bar is however not displayed. > > > >> Are you trying to change the toolbar/menu for you app, or for the > >> whole device? > > > >I want to change the menu toolbar for my application. > > Do you really want to change the toolbar while your application is > running? Or just modify it? I'm not at all sure you can change it. I > know you can modify (add, remove, change captions) an existing > toolbar. > > I think if you step back a bit and explain why you think you need to > change the toolbar, one of us will have a better idea how to help. For > example, tell us what you want the user to see. I want to display different options (through menus I have in the resources) to the user depending on application state. In some states I don't want to display an option menu at all, just an exit menu bar item. > > > > >> > >> > > >> >What am I doing wrong? > >> > > >> >Regards, > >> > > >> >Johannes > >> > >> ----------------------------------------- > >> 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 > |
| |||
| Re: Dynamically replace menu toolbar On Wed, 8 Aug 2007 00:19:14 -0700, Johannes <Johannes@discussions.microsoft.com> wrote: > > >"r_z_aret@pen_fact.com" wrote: > >> On Mon, 6 Aug 2007 23:46:00 -0700, Johannes >> <Johannes@discussions.microsoft.com> wrote: >> >> >See below. >> > >> >"r_z_aret@pen_fact.com" wrote: >> > >> >> On Mon, 6 Aug 2007 02:24:04 -0700, Johannes >> >> <Johannes@discussions.microsoft.com> wrote: >> >> >> >> >I would like to replace the toolbar with another toolbar from my resources >> >> >using the Windows. >> >> > >> >> >My attempt so far involves: >> >> > >> >> >1. Calling SHCreateMenuBar when the application is initialized to load a >> >> >toolbar from my resources. >> >> >> >> This is the right function to use when creating a menu for a Windows >> >> Mobile application >> >> >> >> >> >> > >> >> >2. Calling CommandBar_Destroy + SHCreateMenuBar to change it to another >> >> >toolbar. This does not work; the Windows start menu toolbar is displayed >> >> >instead even though SHCreateMenuBar does not indicate an error. >> >> >> >> I don't see any reason to call CommandBar_Destroy. What is "it" in the >> >> phrase "change it to another toolbar"? How are you checking >> >> SHCreateMenuBar for errors? >> > >> >I check both the return of SHCreateMenuBar and IsWindow(hwndMB). >> >> Try calling GetLastError message when SHCreateMenuBar fails, and then >> use Tools->Error Lookup to interpret the error code from GetLastError. >> If you don't understand the explanation (likely, because they _are_ >> cryptic), report it here and someone will likely provide a more >> understandable interpretation. > >You seem to have misunderstood me. It does not give any error message, >SHCreateMenuBar and IsWindow returns true. The menu bar is however not >displayed. > >> > >> >> Are you trying to change the toolbar/menu for you app, or for the >> >> whole device? >> > >> >I want to change the menu toolbar for my application. >> >> Do you really want to change the toolbar while your application is >> running? Or just modify it? I'm not at all sure you can change it. I >> know you can modify (add, remove, change captions) an existing >> toolbar. >> >> I think if you step back a bit and explain why you think you need to >> change the toolbar, one of us will have a better idea how to help. For >> example, tell us what you want the user to see. > >I want to display different options (through menus I have in the resources) >to the user depending on application state. In some states I don't want to >display an option menu at all, just an exit menu bar item. I do that by adding and removing items from the existing Tool Bar. I use CommandBar_AddBitmap; it works for all Windows CE platforms I've tried, including several variations of Windows Mobile. I _think_ if you define the variable submenus (the ones you want to add and remove) separately, you can use submenus defined in resource files. Something like POPUP ACTIONS_STRING BEGIN MENUITEM TOGGLE_SIP_STRING, IDM_SHOWSIP END But I've never tried such a thing. > >> >> > >> >> >> >> > >> >> >What am I doing wrong? >> >> > >> >> >Regards, >> >> > >> >> >Johannes >> >> >> >> ----------------------------------------- >> >> 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 >> ----------------------------------------- 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 |
![]() |
| Bookmarks |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| No Toolbar/Menu on IE Window | Bruce Ogden | Internet Explorer | 1 | 05-24-2007 02:10 AM |
| add program to toolbar or tools menu ? | Bill | Internet Explorer | 1 | 05-06-2007 07:43 AM |
| add program to toolbar or tools menu ? | Bill | Internet Explorer | 1 | 05-06-2007 07:43 AM |
| menu toolbar in office 2003 | sallyanne | Microsoft Office | 3 | 01-15-2007 11:32 AM |
| Toolbar above menu is a kludge isn't it? | C. Moya | Windows Vista | 3 | 01-02-2007 07:14 AM |