Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Menu Bitmaps from Minimal Source Code in Dialog

Menu Bitmaps from Minimal Source Code in Dialog

Scheduled Pinned Locked Moved C / C++ / MFC
helptutorialc++comgraphics
5 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • I Offline
    I Offline
    Igor Mihailov
    wrote on last edited by
    #1

    Hello, could you please help me? Here's an article: http://www.codeproject.com/menu/bmpmenu.asp The last comment is about using bitmap menu in dialog: "I will use the MSDN example project dlgcbr32 to demonstrate this. Dlgcbr32 demonstrates how to add control bars to a dialog based application. Build dlgcbr32 and then follow these steps (the first 5 steps are essentially the same steps given in the original article): 1. Add these files to your project: BitmapMenu.cpp, BitmapMenu.h, and winuser2.h 2. In Mdlsmain.h add this line: #include "BitmapMenu.h" 3. In Mdlsmain.h inherit your modeless dialog from BitmapMenu: class CModelessMain : public BitmapMenu 4. In Mdlsmain.cpp add two message handlers (the third message handler ON_WM_INITMENUPOPUP() is already there): ON_WM_MEASUREITEM() ON_WM_DRAWITEM() 5. In Mdlsmain.cpp at the end of the CModelessMain::OnInitDialog() function add the tool bar: AddToolBar(&m_toolBar); 6. At the beginning of BitmapMenu.cpp add this line: #include "Modeless.h" 7. At the end of BitmapMenu.cpp add this line: template BitmapMenu; 8. In Mdlsmain.cpp at the beginning of the function CModelessMain::OnInitMenuPopup() add this line: BitmapMenu::OnInitMenuPopup(pPopupMenu, nIndex, bSysMenu); 9. At the top of BitmapMenu.h add this line: #include " The only thing that can't be compiled after perfoming all steps to use bitmap menu in dialog is this line: CColorLBTestDlg::CColorLBTestDlg(CWnd* pParent /*=NULL*/):CDialog(CColorLBTestDlg::IDD, pParent) The error i get: error C2614: 'CColorLBTestDlg' : illegal member initialization: 'CDialog' is not a base or member Thanks in advance!

    G 1 Reply Last reply
    0
    • I Igor Mihailov

      Hello, could you please help me? Here's an article: http://www.codeproject.com/menu/bmpmenu.asp The last comment is about using bitmap menu in dialog: "I will use the MSDN example project dlgcbr32 to demonstrate this. Dlgcbr32 demonstrates how to add control bars to a dialog based application. Build dlgcbr32 and then follow these steps (the first 5 steps are essentially the same steps given in the original article): 1. Add these files to your project: BitmapMenu.cpp, BitmapMenu.h, and winuser2.h 2. In Mdlsmain.h add this line: #include "BitmapMenu.h" 3. In Mdlsmain.h inherit your modeless dialog from BitmapMenu: class CModelessMain : public BitmapMenu 4. In Mdlsmain.cpp add two message handlers (the third message handler ON_WM_INITMENUPOPUP() is already there): ON_WM_MEASUREITEM() ON_WM_DRAWITEM() 5. In Mdlsmain.cpp at the end of the CModelessMain::OnInitDialog() function add the tool bar: AddToolBar(&m_toolBar); 6. At the beginning of BitmapMenu.cpp add this line: #include "Modeless.h" 7. At the end of BitmapMenu.cpp add this line: template BitmapMenu; 8. In Mdlsmain.cpp at the beginning of the function CModelessMain::OnInitMenuPopup() add this line: BitmapMenu::OnInitMenuPopup(pPopupMenu, nIndex, bSysMenu); 9. At the top of BitmapMenu.h add this line: #include " The only thing that can't be compiled after perfoming all steps to use bitmap menu in dialog is this line: CColorLBTestDlg::CColorLBTestDlg(CWnd* pParent /*=NULL*/):CDialog(CColorLBTestDlg::IDD, pParent) The error i get: error C2614: 'CColorLBTestDlg' : illegal member initialization: 'CDialog' is not a base or member Thanks in advance!

      G Offline
      G Offline
      Gary R Wheeler
      wrote on last edited by
      #2

      Check your header file (.h) that contains the declaration for ColorLBTestDlg. If should include a line like this:

      class ColorLBTestDlg : public CDialog {
      //...


      Software Zen: delete this;

      Fold With Us![^]

      I 1 Reply Last reply
      0
      • G Gary R Wheeler

        Check your header file (.h) that contains the declaration for ColorLBTestDlg. If should include a line like this:

        class ColorLBTestDlg : public CDialog {
        //...


        Software Zen: delete this;

        Fold With Us![^]

        I Offline
        I Offline
        Igor Mihailov
        wrote on last edited by
        #3

        Nope, the class must be defined like this: class CModelessMain : public BitmapMenu<CModelessDialog> This is the author's idea.

        G 1 Reply Last reply
        0
        • I Igor Mihailov

          Nope, the class must be defined like this: class CModelessMain : public BitmapMenu<CModelessDialog> This is the author's idea.

          G Offline
          G Offline
          Gary R Wheeler
          wrote on last edited by
          #4

          You need to modify your constructor call to match the signature of his constructor, then.


          Software Zen: delete this;

          Fold With Us![^]

          I 1 Reply Last reply
          0
          • G Gary R Wheeler

            You need to modify your constructor call to match the signature of his constructor, then.


            Software Zen: delete this;

            Fold With Us![^]

            I Offline
            I Offline
            Igor Mihailov
            wrote on last edited by
            #5

            But how?

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups