wxWince : SHCreateMenuBar failed

Do you have a typical platform dependent issue you're battling with ? Ask it here. Make sure you mention your platform, compiler, and wxWidgets version.
Post Reply
romeo9423
Experienced Solver
Experienced Solver
Posts: 72
Joined: Mon Nov 08, 2004 3:36 pm

wxWince : SHCreateMenuBar failed

Post by romeo9423 » Mon Feb 12, 2007 4:22 pm

Hi,

I am trying to use wxwince with xrc. So basically I have a wxdialog defined in a XRC and when I load it I get the following message :SHCreateMenuBar failed

Code: Select all

CApplicationDlg::CApplicationDlg( wxWindow* parent )
{
wxXmlResource::Get()->LoadDialog(this, parent, _("ApplicationDlg"));
}


It comes from here :
tbarwce.cpp:

Code: Select all

bool wxToolMenuBar::MSWCreateToolbar(const wxPoint& WXUNUSED(pos), const wxSize& WXUNUSED(size), wxMenuBar* menuBar)
{
...
#if defined(WINCE_WITHOUT_COMMANDBAR)
    // Create the menubar.
    SHMENUBARINFO mbi;

    memset (&mbi, 0, sizeof (SHMENUBARINFO));
    mbi.cbSize     = sizeof (SHMENUBARINFO);
    mbi.hwndParent = (HWND) GetParent()->GetHWND();
#ifdef __SMARTPHONE__
    mbi.nToolBarId = 5002;
#else
    mbi.nToolBarId = 5000;
#endif
    mbi.nBmpId     = 0;
    mbi.cBmpImages = 0;
    mbi.dwFlags = 0 ; // SHCMBF_EMPTYBAR;
    mbi.hInstRes = wxGetInstance();

    if (!SHCreateMenuBar(&mbi))
    {
        wxFAIL_MSG( _T("SHCreateMenuBar failed") );
        return false;
    }

    SetHWND((WXHWND) mbi.hwndMB);
#else
    HWND hWnd = CommandBar_Create(wxGetInstance(), (HWND) GetParent()->GetHWND(), GetId());
    SetHWND((WXHWND) hWnd);
#endif
...
}
Should i declare a toolbar in my xrc ?
Or do I need to do something different ?.
Or Maybe I should recompile wxwidgets with WINCE_WITHOUT_COMMANDBAR
[/code]

Where is declare this id of 5000 ?

User avatar
Ryan Norton
Moderator
Moderator
Posts: 1319
Joined: Mon Aug 30, 2004 6:01 pm

Post by Ryan Norton » Mon Feb 12, 2007 6:35 pm

Maybe this thread could help?

http://forums.wxwidgets.org/viewtopic.p ... atemenubar[/url]
[Mostly retired moderator, still check in to clean up some stuff]

romeo9423
Experienced Solver
Experienced Solver
Posts: 72
Joined: Mon Nov 08, 2004 3:36 pm

Post by romeo9423 » Mon Feb 12, 2007 6:52 pm

Ryan Norton wrote:Maybe this thread could help?

http://forums.wxwidgets.org/viewtopic.p ... atemenubar[/url]
Not Really. I mean of course it helps but it's also written that wxwince is not really stable.

Post Reply