Greg Treleaven
Greg Treleaven

Reputation: 8444

Syntax Error in dialog resource

I have a Win32 GUI application and in my resource.rc file I'm trying to create a dialog, but I get a syntax error in my code.

IDD_ABOUT DIALOG 0, 0, 239, 66
STYLE DS_MODALFRAME | WS_CAPTION | WS_POPUP | WS_SYSMENU // error here
CAPTION "About"
FONT 8, "MS Sans Serif"
BEGIN
   DEFPUSHBUTTON "&OK", IDOK, 174, 27, 50, 14
   GROUPBOX "Blahblah...", IDC_STATIC, 7, 7, 225, 52
   CTEXT "Name: Blahblah\r\nVersion: blahblahblah\r\nAuthor: blahblahblah\r\nDescription: blahblahblah", IDC_STATIC, 15, 18, 144, 33
END

(Of course, it doesn't really say blahblahblah.) I Google'd around and found some similar questions, but they were all to do with the groupbox line and IDC_STATIC not being declared. IDC_STATIC isn't declared in mine either and if I hover over it, the 'tooltip' it gives is all the lines of my menu resource. But I don't think this has anything to do with it, because its a different line that's causing the problem.

What am I doing wrong?

(In case its needed, I'm using CodeBlocks with MinGW on Windows 7)

Upvotes: 2

Views: 2064

Answers (2)

Ben
Ben

Reputation: 57209

In case anyone else runs into this scenario, @Ise Wisteria's answer is great. However, after that fix, I got the same error again, which turned out to be a little misleading.

My problem was in resource definition - turns out I was missing IDC_STATIC which threw the same syntax error for a different reason.

(Also using C::B MinGW Win7)

Upvotes: 0

Ise Wisteria
Ise Wisteria

Reputation: 11659

Please forgive me if this is an irrelevant pointing out.
I think STYLE's argument values like window style(WS_...) and dialog box style(DS_...) are defined in a system header file.
So, probably <windows.h> or similar header file has to be #includeed before the use of those values.
Hope this helps.

Upvotes: 5

Related Questions