menu resource file

This is a discussion on menu resource file within the Windows Programming forums, part of the Platform Specific Boards category; I'm trying to learn windows programming using VC 6.00++ and few books (and a reference). I'm stuck withe the menu ...

  1. #1
    Registered User
    Join Date
    Dec 2001
    Posts
    2

    Question menu resource file

    I'm trying to learn windows programming using VC 6.00++ and few books (and a reference). I'm stuck withe the menu resource file. I can create and attach a menu using resource file editor where you can choose from several options, but the books give an alternative which is, I quote: "resource script files are simply uncompiled text files", and looks like this:

    Menu_Name MENU DISCARDABLE
    {
    POPUP "File"
    {MENUITEM "Open", FILE_ID_OPEN
    MENUITEM "Close", FILE_ID_CLOSE
    MENUITEM "Save", FILE_ID_SAVE
    MENUITEM "Exit", FILE_ID_EXIT}
    POPUP "Help"
    {MENUITEM "About", FILE_ID_ABOUT}
    }//EOF

    My question is where do you put this "code" (how do you attach it to the project), what file (folder), what extension (file type), what editor type you use, and anything else that would be helpful.
    Thank you much, Mike.

  2. #2
    Registered User
    Join Date
    Jan 2002
    Posts
    387
    with VC++, you dont write the code, its all drag and drop, goto Insert>Resource then click on Menu.

    to implement the menu you go something like:

    WNDCLASSEX wc;
    wc.lpfnMenuName = MAKEINTRESOURCE(/*ID OF MENU*/);
    "There are three kinds of people in the world...
    Those that can count and those that can't."

  3. #3
    Rage7531
    Guest
    I actually write my own resource files.. etc.. wanted to know what makes 'em tick.. and i just ended up writing em myself..

    --------------menu.rc--------------------------

    #include "resource.h"

    My_Menu MENU
    BEGIN
    POPUP "&File"
    BEGIN
    MENUITEM "&New", IDM_New
    MENUITEM "&Quit", IDM_Quit
    END
    POPUP "&Edit"
    BEGIN
    MENUITEM "&Copy", IDM_Copy
    MENUITEM "&Paste", IDM_Paste
    END
    END


    ---------------menu.h---------------

    #define IDR_MENU1 101
    #define IDM_New 40001
    #define IDM_Quit 40002
    #define IDM_Copy 40003
    #define IDM_Paste 40004

    ----------------menu.cpp-------------------------

    wndclass.lpszMenuName = "My_Menu";


    case WM_COMMAND:
    if(LOWORD(wParam) == IDM_New)
    {
    }
    if(LOWORD(wParam) == IDM_Quit)
    {
    PostQuitMessage(0);
    }
    break;



    these are 3 files u would need to make a menu.. just include all 3 in a project and it would make a nice menu

    i just use notepad.. but yah VC++... the compiler writes it for u i believe... don't know i currently use borland..

  4. #4
    Registered User
    Join Date
    Jan 2002
    Posts
    387
    how do u look at the actual resource code in VC++?
    "There are three kinds of people in the world...
    Those that can count and those that can't."

  5. #5
    Registered User
    Join Date
    Apr 2002
    Posts
    1,571
    Open the rc file up in Notepad. Notepad is your only friend.

  6. #6
    Registered User
    Join Date
    May 2002
    Posts
    50
    Believe it or not, you actually CAN view the resource code in VC 6.0, but I've only been able to when the error in my program occurs in the resource file. Otherwise I can't find any command that will open the .rc file as text.

    I usually just use Notepad. The files are simple enough anyway. Create a blank .rc file in VC and then go to the directory and open it in Notepad. That way VC includes all the template crap it seems to need and you can just insert your text anywhere you want (well.. within reason.. not like in the middle of lines and words.. etc.).

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. opening empty file causes access violation
    By trevordunstan in forum C Programming
    Replies: 10
    Last Post: 10-22-2008, 12:19 AM
  2. Need Help Fixing My C Program. Deals with File I/O
    By Matus in forum C Programming
    Replies: 7
    Last Post: 04-29-2008, 08:51 PM
  3. gcc link external library
    By spank in forum C Programming
    Replies: 6
    Last Post: 08-08-2007, 04:44 PM
  4. Basic text file encoder
    By Abda92 in forum C Programming
    Replies: 15
    Last Post: 05-22-2007, 02:19 PM

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