Friday, July 12, 2013

BEGIN expected in dialog

When you have a resource file used by both a Win32 project and a WinCE project, and if you edit the resource file using the Win32 resource editor in Visual Studio, you will get errors like this when the WinCE resource compiler tries to compile it:
.\Resource.rc(112) : error RC2112 : BEGIN expected in dialog
.\Resource.rc(112) : error RC2135 : file not found: 0x1
.\Resource.rc(114) : error RC2135 : file not found: ...
.\Resource.rc(116) : error RC2135 : file not found: PUSHBUTTON
.\Resource.rc(119) : error RC2135 : file not found: CONTROL
The error occurs on a "FONT" line like this:
...
STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_CLIPSIBLINGS | WS_CLIPCHILDREN
FONT 8, "MS Shell Dlg", 0, 0, 0x1
BEGIN
...
To fix the error, simply remove the last three parameters:
...
STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_CLIPSIBLINGS | WS_CLIPCHILDREN
FONT 8, "MS Shell Dlg"
BEGIN
...
Fixed!