-
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?
-
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
-
Does anyone have a link to a good windows tutorial site?
-
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! :confused:
-
Try:
Code:
wc.lpszMenuName = MAKEINTRESOURCE(MainMenu);
-