1. We have moved from vBulletin to XenForo and you are viewing the site in the middle of the move. Though the functional aspect of everything is working fine, we are still working on other changes including the new design on Xenforo.
    Dismiss Notice

Display Icon or Bitmap at Menuitem

Discussion in 'MFC' started by cb02061, Jun 19, 2008.

  1. cb02061

    cb02061 New Member


    I have been developed a SDI application. I want to show icon or bitmap at menuitem.
    I already tested codes below, but it's not working???
    I got assertion failure error...
    I need help???

    CBitmap m_bmpMenuFileNew; //File new bitmap (Checked and unchecked)
    CBitmap m_bmpMenuFileOpen; //File open bitmap (Checked and unchecked)
    int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
    if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
    return -1;
    //Load the bitmap resource
    ASSERT( m_bmpMenuFileNew.LoadBitmap( IDB_MENU_NEW ) );
    ASSERT( m_bmpMenuFileOpen.LoadBitmap( IDB_MENU_OPEN ) );
    //Access the application menu
    CMenu* pMenu = GetMenu();
    ASSERT( pMenu );
    //Assign the icon
    ASSERT( pMenu->SetMenuItemBitmaps( ID_FILE_NEW, MF_BYCOMMAND,
    &m_bmpMenuFileNew, &m_bmpMenuFileNew ) );
    ASSERT( pMenu->SetMenuItemBitmaps( ID_FILE_OPEN, MF_BYCOMMAND,
    &m_bmpMenuFileOpen, &m_bmpMenuFileOpen ) );
    return 0;
    if( m_bmpMenuFileNew.m_hObject )
    if( m_bmpMenuFileOpen.m_hObject )
    Last edited by a moderator: Jun 19, 2008

Share This Page