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
  1. Home
  2. General Programming
  3. ATL / WTL / STL
  4. Building Graphical Menu Choices

Building Graphical Menu Choices

Scheduled Pinned Locked Moved ATL / WTL / STL
helpc++question
2 Posts 2 Posters 8 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.
  • T Offline
    T Offline
    Tino Debelo
    wrote on last edited by
    #1

    Hi. I wrote a code that should have graphical menu choices. But I am getting error I believe it is syntax error where it does the menu choices. Can you please help me fix it for me? It has a lot of errors I believe they are syntax. I am thinking if I fix few errors all of them will be perfect. Please post your code. Thank you so much. Here is the part of the code that I have problem.

    CWindow :
    {
    public:

    CContainedWindow m\_Parent;
    CWindow() :
    	m\_Parent(this, 1){}
    

    protected:
    typedef CWindowImpl<T, TBase, TWinTraits> baseClass;
    BEGIN_MSG_MAP(CWindow)
    other msgs
    ALT_MSG_MAP(1)
    MESSAGE_HANDLER(WM_DRAWITEM, OnDrawItem)
    END_MSG_MAP()
    {

    	}
    

    };

    CWindow
    {
    public:
    DECLARE_WND_SUPERCLASS(_T("WTL_CButtonMenu"), GetWndClassName())
    CButtonMenu& operator=(HWND hWnd)
    {
    if (m_hWnd)
    DestroyWindow();
    if (::IsWindow(hWnd))
    SubclassWindow(hWnd);
    return *this;
    }
    // Member variable of dialog
    CWindow btnMenu;

    // Somewhere in WM\_INITDIALOG handler
    btnMenu = GetDlgItem(IDC\_BTN\_ABOUT);
    btnMenu.AddMenuItem(IDC\_MNU\_ONE, "Windows");
    btnMenu.AddMenuItem(IDC\_MNU\_TWO, "Template");
    btnMenu.AddMenuItem(IDC\_MNU\_THREE, "", MF\_SEPARATOR);
    btnMenu.AddMenuItem(IDC\_MNU\_FOUR, "Library");
    

    };

    L 1 Reply Last reply
    0
    • T Tino Debelo

      Hi. I wrote a code that should have graphical menu choices. But I am getting error I believe it is syntax error where it does the menu choices. Can you please help me fix it for me? It has a lot of errors I believe they are syntax. I am thinking if I fix few errors all of them will be perfect. Please post your code. Thank you so much. Here is the part of the code that I have problem.

      CWindow :
      {
      public:

      CContainedWindow m\_Parent;
      CWindow() :
      	m\_Parent(this, 1){}
      

      protected:
      typedef CWindowImpl<T, TBase, TWinTraits> baseClass;
      BEGIN_MSG_MAP(CWindow)
      other msgs
      ALT_MSG_MAP(1)
      MESSAGE_HANDLER(WM_DRAWITEM, OnDrawItem)
      END_MSG_MAP()
      {

      	}
      

      };

      CWindow
      {
      public:
      DECLARE_WND_SUPERCLASS(_T("WTL_CButtonMenu"), GetWndClassName())
      CButtonMenu& operator=(HWND hWnd)
      {
      if (m_hWnd)
      DestroyWindow();
      if (::IsWindow(hWnd))
      SubclassWindow(hWnd);
      return *this;
      }
      // Member variable of dialog
      CWindow btnMenu;

      // Somewhere in WM\_INITDIALOG handler
      btnMenu = GetDlgItem(IDC\_BTN\_ABOUT);
      btnMenu.AddMenuItem(IDC\_MNU\_ONE, "Windows");
      btnMenu.AddMenuItem(IDC\_MNU\_TWO, "Template");
      btnMenu.AddMenuItem(IDC\_MNU\_THREE, "", MF\_SEPARATOR);
      btnMenu.AddMenuItem(IDC\_MNU\_FOUR, "Library");
      

      };

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      What is the error? Are you sure you can add a menu item to a button?

      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