Tzu ng
Tzu ng

Reputation: 9244

Resource.h in Windows API simple app

there'are these lines in the sample Win32 app created default by VS. Can you explain why they're just numbers, and it's meaning :)

//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by Testing Project.rc
//

#define IDS_APP_TITLE           103

#define IDR_MAINFRAME           128
#define IDD_TESTINGPROJECT_DIALOG   102
#define IDD_ABOUTBOX            103
#define IDM_ABOUT               104
#define IDM_EXIT                105
#define IDI_TESTINGPROJECT          107
#define IDI_SMALL               108
#define IDC_TESTINGPROJECT          109
#define IDC_MYICON              2
#ifndef IDC_STATIC
#define IDC_STATIC              -1
#endif
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS

#define _APS_NO_MFC                 130
#define _APS_NEXT_RESOURCE_VALUE    129
#define _APS_NEXT_COMMAND_VALUE     32771
#define _APS_NEXT_CONTROL_VALUE     1000
#define _APS_NEXT_SYMED_VALUE       110
#endif
#endif

Upvotes: 0

Views: 1770

Answers (1)

Hans Passant
Hans Passant

Reputation: 942227

The resource.h only declares the resource identifiers. It is included by your code, the resource ids are used in your code to load the resources. The actual resources are defined in your project's .rc file.

Right-click the .rc file in the Solution Explorer window, select Open With and choose Text Editor. Click through the warnings, if any, and you'll see the actual resources declared. Note how it also #includes resource.h. The .rc file gets translated by the resource compiler into a .res file and linked to your binary by the linker.

Upvotes: 3

Related Questions