
Dynamically changing text of a menu in a Dialog box
Hi,
i have been lokking here for the old message here to find any clues
tio solve my problem, but none of them work on Pocket PC 2002
(emulator, COMPAQ or Loox).
what i am trying to do seems vey simple to me :
changing the text of the menu dynamically depending on the langage the
user installed on his device.
i have no trouble for the sub-menu, but no-way to do it for the base
menu in the command tool bar.
i try 2 ways :
- pmnuMainMenu->ModifyMenu(0, MF_BYPOSITION,
pmnuMainMenu->GetMenuItemID(0), _T("toto") ) ;
to change the first item of the Menu (the traditionnaly File), it does
nothing, but by the way i loose the sub-menu traditionnally associated
with him.
- TBBUTTONINFO tbbi = {0} ;
tbbi.cbSize = sizeof(TBBUTTONINFO) ;
tbbi.dwMask = TBIF_TEXT;
TCHAR szBuf[255] ;
tbbi.pszText = szBuf ;
tbbi.cchText = 255 ;
tbbi.cbSize = sizeof(TBBUTTONINFO) ;
int iResult = m_wndCommandBar.SendMessage(TB_GETBUTTONINFO,
pmnuMainMenu->GetMenuItemID(0), (LPARAM)&tbbi) ;
tbbi.pszText = _T("toto");
iResult = m_wndCommandBar.SendMessage(TB_SETBUTTONINFO,
pmnuMainMenu->GetMenuItemID(0), (LPARAM)&tbbi) ;
do nothing because my SendMessage return an error.
to be more precise my beginig code is :
if(!m_wndCommandBar.Create(this) || ! (pmnuMainMenu=
m_wndCommandBar.InsertMenuBar(IDR_MENUBAR_MAINDLG, 0) ) ||
!m_wndCommandBar.AddAdornments())
{
TRACE0("Failed to create CommandBar\n");
return -1; // fail to create
}
m_wndCommandBar.LoadToolBar(IDR_TOOLBAR_MAIN);
m_wndCommandBar.SetBarStyle(m_wndCommandBar.GetBarStyle() |
CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_FIXED);
Hope somebody will answer me to uderstand what his my mistake....