How to add soft keys / menus to Windows mobile 5.0 pocket pc MFC dialog based application?

How to add soft keys / menus to Windows mobile 5.0 pocket pc MFC dialog based application

I am able to create the menu resource. But I am not able to add the menu to the dialog as I normally do in desktop MFC application. When I select the dialog properties, it is not showing the "Menu" option where I can specify the name of my menu resource.

Please help



Answer this question

How to add soft keys / menus to Windows mobile 5.0 pocket pc MFC dialog based application?

  • gmcbay

    Hi,

    The best way to see how the menus need to manipulated in VS 2005 project is to start off with a Wizard generated SDI MFC application.

    Starting with VS2005 the menus need to be addeded with CCommandBar class. You need to add a CCommandBar member to your dialog class and then use the following code in your Dialog's InitiDialog method. Add menu resource through the resource view, or you may like to copy a template from some where and proceed to modify it from there on.

    if (!m_dlgCommandBar.Create(this) ||

    !m_dlgCommandBar.InsertMenuBar(IDR_MAINFRAME)) //IDR_MAINFRAME is the ID of the enu resource to be added.

    {

    TRACE0("Failed to create CommandBar\n");

    return FALSE; // fail to create

    }

    //Sample Menu reosuce to added to the rc file.

    IDR_MAINFRAME MENU DISCARDABLE

    BEGIN

    MENUITEM "OK", IDOK

    END

    Hope this helps.

    Thanks



  • How to add soft keys / menus to Windows mobile 5.0 pocket pc MFC dialog based application?