What do I need to include to use IDC_STATIC?

Just like the title, what file do I need to include to use line 10 and 12 in this code?

1
2
3
4
5
6
7
8
9
10
11
12
13
#include <windows.h>

IDD_ABOUT DIALOG DISCARDABLE 0, 0, 239, 66
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "My About Box"
FONT 8, "MS Sans Serif"
{
    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           "My dialog about this program",
                    IDC_STATIC, 16, 18, 144, 33
}


EDIT:
I get a syntax error. Did on line 4 until I included windows.h, so I'm guessing I'm missing an included file?
Last edited on
resource file?
Nope!

IDC_STATIC isn't defined in any of the normal Windows SDK headers.

When Visual Studio generates a Windows app project, it adds

1
2
3
#ifndef IDC_STATIC
#define IDC_STATIC (-1)
#endif 


to the resource.h it generates.

Do you have a resource.h yet?

Andy

PS IDC_STATIC is defined by the MFC and ATL headers.
Last edited on
@OP

These kinda posts must be at the Windows Programming section(although responses from there are weak).
This is my dialog.rc resource file, sorry, forgot to tell.

Now I've put #define IDC_STATIC (-1) in my *.h file and included it, now it's working.

Why do I need #ifndef and #endif ? I did just type in #define IDC_STATIC (-1) and it works great...

What is the MFC and ATL headers?
The #ifdef/#endif are in case you include two headers that both #define IDC_STATIC, just in case no one else has.

And MFC and ATL are libraries which come with Visual C++ Standard Edition and above (i.e. the paid for versions). MFC is the Microsoft Foundation Classes library, for writing applications, and ATL the Active Template Library, for writing COM (Component Object Model) components.

Google if you want to know more!

Andy
Last edited on
@Aceix

I'm a beginner and this is a beginner question. And I'm getting help from the kind people here, so it's not to advanced for a beginner section.

Or am I wrong?
Last edited on
@Hashimatsu

I think Aceix was suggesting that it might be better in the Windows forum as it's Windows specific, even though it is a basic question.

This forum is best left to the general C++ kind of question.

BTW you are the OP = Original Poster (the person who begins the thread)

Andy
Last edited on
Topic archived. No new replies allowed.