-
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.
-
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*/);
-
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..
-
how do u look at the actual resource code in VC++?
-
Open the rc file up in Notepad. Notepad is your only friend. :)
-
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.).