Urbs
Urbs

Reputation: 131

DialogBox Resource for WINAPI in CMAKE resource file returning syntax error

I'm trying to load a DialogBox into my WIN32 Application via resource file but CMake is throwing a syntax error.

The Code in my resource file:

#include "resource.h"
IDD_ABOUTDIALOG DIALOG 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",
                    IDC_STATIC,16,18,144,33
END

The c code which would load the resource:

int ret = DialogBox(GetModuleHandle(NULL),
MAKEINTRESOURCE(IDD_ABOUTDIALOG), hwnd, AboutDlgProc);

The resource header file:

#ifndef WIN32_RESOURCE_H
#define WIN32_RESOURCE_H

#define IDD_ABOUTDIALOG 101

#endif //WIN32_RESOURCE_H

The error message printed by CMake:

Resource.rc:3: syntax error

I'm using MinGW in CLION (C11 Standard)

Upvotes: 0

Views: 209

Answers (1)

Strive Sun
Strive Sun

Reputation: 6299

Generally, STYLE parameters such as window style (WS_) and dialog style (DS_) are defined in the system header file.

Therefore, to add #<windows.h> before using these values, you must #include to edit possible or similar header files.

Upvotes: 1

Related Questions