MainMenu class

This is a discussion on MainMenu class within the Windows Programming forums, part of the Platform Specific Boards category; Code: MainMenu MENU DISCARDABLE { POPUP "File" { MENUITEM "Open", MENU_FILE_ID_OPEN MENUITEM "Close", MENU_FILE_ID_CLOSE } POPUP "Help" { MENUITEM "About", ...

  1. #1
    C / C++
    Join Date
    Jan 2006
    Location
    The Netherlands
    Posts
    312

    MainMenu class

    Code:
    MainMenu MENU DISCARDABLE
    
    {
    
    POPUP "File"
    
             {
    
             MENUITEM "Open", MENU_FILE_ID_OPEN
    
             MENUITEM "Close", MENU_FILE_ID_CLOSE
    
    }
    
    POPUP "Help"
    
             {
    
             MENUITEM "About", MENU_HELP_ID_ABOUT
    
             }
    
    }
    I used this code in my first windows program, but my Borland compiler gives the following error: Declaration syntax error

    What should I change?
    Operating Systems:
    - Ubuntu 9.04
    - XP

    Compiler: gcc

  2. #2
    Registered User
    Join Date
    Oct 2005
    Posts
    10
    Hellow;

    Check the content the resource.h file???.

    #define MENU_FILE_ID_OPEN 100

    #define MENU_FILE_ID_CLOSE 102

    #define MENU_HELP_ID_ABOUT 102????

    #define MainMenu 103

    How count the menu in the *.rc file???


    Code:
    MainMenu MENU DISCARDABLE
    
    BEGIN
             POPUP "File"
             BEGIN
                   MENUITEM "Open", MENU_FILE_ID_OPEN
    
                   MENUITEM "Close", MENU_FILE_ID_CLOSE
             END
             POPUP "Help"
             BEGIN
                   MENUITEM "About", MENU_HELP_ID_ABOUT
             END
    END

    Otherwise, NOT declarate the following file, inside the *.rc file!!!!:

    #include <windows.h>

    The source code:


    Code:
    #include <windows.h>
    #include "resource.h"
    
    MainMenu MENU DISCARDABLE
    
    BEGIN
             POPUP "File"
             BEGIN
                   MENUITEM "Open", MENU_FILE_ID_OPEN
    
                   MENUITEM "Close", MENU_FILE_ID_CLOSE
             END
             POPUP "Help"
             BEGIN
                   MENUITEM "About", MENU_HELP_ID_ABOUT
             END
    END
    Bye
    Last edited by nostromos; 02-23-2006 at 03:55 PM.

  3. #3
    C / C++
    Join Date
    Jan 2006
    Location
    The Netherlands
    Posts
    312
    Does anyone have a link to a good windows tutorial site?
    Operating Systems:
    - Ubuntu 9.04
    - XP

    Compiler: gcc

  4. #4
    C / C++
    Join Date
    Jan 2006
    Location
    The Netherlands
    Posts
    312
    Ok, now I have resources.rc:

    Code:
    #include <windows.h>
    #include "resource.h"
    
    MainMenu MENU DISCARDABLE
    
    BEGIN
             POPUP "File"
             BEGIN
                   MENUITEM "Open", MENU_FILE_ID_OPEN
    
                   MENUITEM "Close", MENU_FILE_ID_CLOSE
             END
             POPUP "Help"
             BEGIN
                   MENUITEM "About", MENU_HELP_ID_ABOUT
             END
    END
    resource.h:

    Code:
    #define MENU_FILE_ID_OPEN 100
    
    #define MENU_FILE_ID_CLOSE 102
    
    #define MENU_HELP_ID_ABOUT 102
    
    #define MainMenu 103
    and in wc.cpp:

    Code:
    #include "resource.h"
    
    // rest of script
    
    wc.lpszMenuName = "MainMenu";
    
    // rest of script
    No errors and no menu!
    Operating Systems:
    - Ubuntu 9.04
    - XP

    Compiler: gcc

  5. #5
    carry on JaWiB's Avatar
    Join Date
    Feb 2003
    Location
    Seattle, WA
    Posts
    1,972
    Try:
    Code:
    wc.lpszMenuName = MAKEINTRESOURCE(MainMenu);
    "Think not but that I know these things; or think
    I know them not: not therefore am I short
    Of knowing what I ought."
    -John Milton, Paradise Regained (1671)

    "Work hard and it might happen."
    -XSquared

  6. #6
    C / C++
    Join Date
    Jan 2006
    Location
    The Netherlands
    Posts
    312
    No, doesn't work.
    Operating Systems:
    - Ubuntu 9.04
    - XP

    Compiler: gcc

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Class design problem
    By h3ro in forum C++ Programming
    Replies: 10
    Last Post: 12-19-2008, 09:10 AM
  2. Specializing class
    By Elysia in forum C++ Programming
    Replies: 6
    Last Post: 09-28-2008, 05:30 AM
  3. matrix class
    By shuo in forum C++ Programming
    Replies: 2
    Last Post: 07-13-2007, 02:03 AM
  4. Screwy Linker Error - VC2005
    By Tonto in forum C++ Programming
    Replies: 5
    Last Post: 06-19-2007, 03:39 PM
  5. Abstract class problem
    By VanJay011379 in forum C++ Programming
    Replies: 9
    Last Post: 07-31-2002, 02:30 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21