Re: Accessing Command Bar Menu on iPaq Pocket PC by r_z_aret
r_z_aret
Fri Dec 12 08:49:47 CST 2003
On 11 Dec 2003 23:12:45 -0800, jpuopolo@mvisiontechnology.com (John
Puopolo) wrote:
>All,
>
>I am going to pull my last hair out. This is a very simply problem
>and I can't seem to solve it.. any help appreciated.
>
>I am using Embedded Visual C++ 4 (ev4) to write a simple program of a
>new iPaq (5500) running Pocket PC 2003. UI is standard
>menu-on-the-bottom type.
>
>I have a simple menu defined in the sources -- diplays 2 main items:
>Fruits Veggies. "Fruits" contains "Apple" and "Veggies" contains
>"Celery."
>
>Now PROGRAMATICALLY (believe it or not), I want to add the string
>"Orange" to the menu item "Fruits."
If you are trying to change the caption of an item, then you can use
SetMenuItemInfo
If "Fruits" is in the main menu, and you are trying to insert a new
item, then I think you need to use toolbar functions.
Otherwise, I think you want to:
a) get and store the menu bar HWND from the SHMENUBAR structure used
in SHCreateMenuBar (I save it as a member variable called m_hWnd)
b) get and store the menu bar HMENU, using an SHCMBM_GETMENU message
send to the menu bar window (I save it as a member variable called
m_hMenu)
c) use InsertMenu to insert the new item; you will need something like
the GetSubMenu function below to get the submenu for "Fruits"
// ---------------------------------
HMENU GetSubMenu
(
int nPosMenu // (In) Position in menu of
desired submenu
) const
{
HMENU hMenu = nPosMenu < 0 ? m_hMenu : ::GetSubMenu( m_hMenu,
nPosMenu );
return hMenu;
}
>
>For the love of God I can't do it. I've tried the whole
>SHGetMenu/SHGetSubMenu thing, the CommandBar_ stuff, etc. to no avail.
> Is there some sort of Voodoo Pack I need to make this work?
>
>Any help appreicated (sincerely). Thx.
>
>John
-----------------------------------------
To reply to me, remove the underscores (_) from my email address (and please indicate which newsgroup and message).
Robert E. Zaret
PenFact, Inc.
500 Harrison Ave., Suite 3R
Boston, MA 02118
www.penfact.com