0

I have a resource:

IDC_MYMENU MENU
BEGIN
    POPUP "&File"
    BEGIN
        MENUITEM "E&xit"
    END
    POPUP "&Stuff"
    BEGIN
        MENUITEM "&Go"
    END
END

On the first END it says there is a syntax error, I don't understand why. Anyone know? :(

i_am_jorf
  • 53,608
  • 15
  • 131
  • 222
ITg
  • 140
  • 9

2 Answers2

2

The problem is that you haven't set the ID for the MENUITEM. The resource compiler expects additional parameter after the string. See documentation here: http://msdn.microsoft.com/en-us/library/aa381025%28VS.85%29.aspx

Yakov Galka
  • 70,775
  • 16
  • 139
  • 220
1

You need an ID associated with a menu item, something like:

#include "resources.h"
#include "windows.h"

IDC_MYMENU MENU
BEGIN
    POPUP "&File"
    BEGIN
        MENUITEM "E&xit", ID_EXIT
    END
    POPUP "&Stuff"
    BEGIN
        MENUITEM "&Go", ID_GO
    END
END

where resources.h would look something like:

#define ID_GO 101

[At east if memory serves, ID_EXIT will normally be pre-defined by Windows.h, so you don't need to define it.]

The ID is the value that your program will receive in the WM_COMMAND message when that menu item is selected. The values are (virtually always) in a separate header for you to include in both the RC file and your code to ensure against any mismatches.

Jerry Coffin
  • 476,176
  • 80
  • 629
  • 1,111