1

Possible Duplicate:
Why does Windres report a syntax error on my GROUPBOX statement?

NOTE: This is a repost from yesterday. I really didn't get an answer for it, and it has fallen behind in the C++ (among others) queue.

I'm experimenting with the Win32 API in C++, specifically with writing resource files. Now, my entire project was working just fine, menus and titles and everything. However, when I add this code for a modal dialog box to the .rc file:

IDD_ABOUT DIALOGEX DISCARDABLE  0, 0, 239, 66
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "My About Box"
FONT 8, "MS Sans Serif"
BEGIN
    DEFPUSHBUTTON   "&OK",IDOK,174,18,50,14
    PUSHBUTTON      "&Cancel",IDCANCEL,174,35,50,14
    GROUPBOX        "About this program...",IDC_STATIC,7,7,225,52
    CTEXT           "An example program showing how to use Dialog Boxes\r\n\r\nby theForger", IDC_STATIC,16,18,144,33
END

Windres exits with the following error:

windres: resource.rc:40: syntax error

Line 40 refers to:

GROUPBOX "About this program...",IDC_STATIC,7,7,225,52

According to MSDN,

The GROUPBOX statement, which you can use only in a DIALOGEX statement, defines the text, identifier, dimensions, and attributes of a control window.

GROUPBOX text, id, x, y, width, height [, style [, extended-style]]

Their example:

GROUPBOX "Options", 101, 10, 10, 100, 100

What am I doing wrong?

Community
  • 1
  • 1
Ken Bellows
  • 6,711
  • 13
  • 50
  • 78
  • `Windres` is the GNU resource compiler right? The MS resource compiler `rc` handles your resource file just fine. – David Heffernan Jan 24 '11 at 20:13
  • I don't see why this is tagged C++, it's purely a Windows API and Windres question. – David Heffernan Jan 24 '11 at 20:14
  • Self-admitted duplicate of [Why does Windres report a syntax error on my GROUPBOX statement?](http://stackoverflow.com/questions/4778823/why-does-windres-report-a-syntax-error-on-my-groupbox-statement) The way to get attention for a question is to edit it to add new information, not to re-post it. – Rob Kennedy Jan 24 '11 at 20:17
  • @David: I'll give that a shot. Also, you're right, I suppose I was just thinking in C++, since this file is part of a C++ project. My mistake. @Rob: My mistake. Won't happen again. – Ken Bellows Jan 24 '11 at 20:28
  • Yes, that's defined in . – Ken Bellows Jan 24 '11 at 20:58
  • @KenB @templatetypedef `IDC_STATIC` wasn't defined for me. I just hard coded an ID 'cos I assumed `IDC_STATIC` was defined by you. – David Heffernan Jan 24 '11 at 21:24

1 Answers1

0

There seem to be two possibilities:

  1. Windres has a bug.
  2. Windres has a different spec.

Based on (what at least looks like) the windres spec, your code is wrong -- at least as it's shown, you should have a comma on the end of the GROUPBOX line (optionally followed by a params). My guess, however, is that the comma is really only intended to be there if you also include the params.

Of course, it's possible the grammar they give really reflects what windres accepts, even if that wasn't what was really intended. It should be pretty easy to try adding a comma, and seeing if it accepts that -- but quite frankly I doubt that'll do any good.

As such, option 2 above is clearly correct, but it's entirely possible that option 1 is as well.

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