I am trying to port our application from eVC4 to VS2005 so we can
better support Windows Mobile 5.
Most of the application is working (having to add my own picture
button).
however we do alot of Adding and renaming menus at runtime I cant get
this feature to work with VS2005.
here is the code that dosent work
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CFrameWnd::OnCreate(lpCreateStruct) =3D=3D -1)
return -1;
// create a view to occupy the client area of the frame
if (!m_wndView.Create(NULL, NULL, AFX_WS_DEFAULT_VIEW,
CRect(0, 0, 0, 0), this, AFX_IDW_PANE_FIRST, NULL))
{
TRACE0("Failed to create view window\n");
return -1;
}
if (!m_wndCommandBar.Create(this) ||
!m_wndCommandBar.InsertMenuBar(IDR_MYMENU) /* ||
!m_wndCommandBar.AddAdornments(dwAdornmentFlags) ||
!m_wndCommandBar.LoadToolBar(IDR_MAINFRAME) */ )
{
TRACE0("Failed to create CommandBar\n");
// return -1; // fail to create
}
CMenu *aMenu;
CMenu *aSubMenu;
aMenu =3D CMenu::FromHandle(m_wndCommandBar.GetMenu());
aSubMenu =3D aMenu->GetSubMenu(0);
if(!aSubMenu->InsertMenu(1,MF_BYPOSITION | MF_STRING,1001,TEXT("Hello
World")))
{
int err;
err =3D GetLastError();
TRACE(TEXT("Error =3D %d\n"),err);
}
m_wndCommandBar.DrawMenuBar(0);
m_wndCommandBar.SetBarStyle(m_wndCommandBar.GetBarStyle() |
CBRS_SIZE_FIXED);
return 0;
}
the InsertMenu Call dosent report an error but the item never gets
inserted can anyone please tell me why ?
Thanks Christian Arild St=E6r Andersen