-
Resources problem
Hello, I have recently started programming in WIN32 API in DEV-C++, where I encountred several problems with resources handling:
1)whenever I change my resource file, the compiler throws a syntax error:
{
[Warning] ISO C requires whitespace after the macro name
unrecognized escape sequence unrecognized escape sequence
}
which, for some paranormal reason can be only fixed by editing the resource header file (PROJECT_NAME.h) in any way(adding whitespace, deleting one, whatever...)
2) adding MENUITEM in
Code:
MAINMENU MENU DISCARDABLE
BEGIN
POPUP "FILE"
BEGIN
MENUITEM "The error", IDM_ERROR
END
END
Throws a syntax error
Does anyone has any idea, where the problem could be?
Thanks.
-
That's how I would do it: first create a definitions file ('definitions.h') and declare some values
Code:
#define MY_FILE_OPEN 10
#define MY_FILE_CLOSE 11
Now create an .*rc resource file and declare the menu inside it
Code:
#include <windows.h>
#include "defintions.h"
menu MENU
BEGIN
POPUP "&File"
BEGIN
MENUITEM "&Open",MY_FILE_OPEN
MENUITEM "&Close",MY_FILE_CLOSE
END
END
As you can see the menuitems have an id previously declared in the definitions file. It isn't necessary to declare the definitions (you can do something like 'MENUITEM "&Open",10'), but using definitions will help you to not confusing.
Now add both files to your project and compile it. There shoudn't be any problem.
Niara
-
Garland
Thanks a lot, defining the constants did the job-for now.