Which Is Rc File Data Type?


Larry Thompson

The RC file data type, also known as a resource script file, is a text file used in Microsoft Windows to define resources for an application. It contains a collection of resources such as menus, icons, dialogs, and version information that can be used by the application during runtime.

Structure of an RC File

An RC file is typically written in plain text and follows a specific structure. It consists of various sections that define different types of resources. Let’s take a look at some commonly used sections:

Menu Section

The menu section defines the menus and their items that appear in the application’s user interface. Each menu item is specified with its identifier and caption text. Here’s an example:


Dialog Section

The dialog section defines the various dialogs used in the application. Dialogs are typically used to gather user input or display information.

Each dialog is defined with its identifier, position, size, and controls within it. Here’s an example:

DIALOGEX 0, 0, 250, 150
    CAPTION "Dialog Example"
  • EDITTEXT "Name:", IDC_NAME_EDIT, 20, 30, 200, 20, ES_AUTOHSCROLL>
  • EDITTEXT "Email:", IDC_EMAIL_EDIT, 20, 60, 200, 20, ES_AUTOHSCROLL>
PUSHBUTTON "OK", IDOK, 80, 120, 40, 20 }

Icon Section

The icon section defines the icons used for the application’s executable file. It specifies the icon file associated with each size and color depth. Here’s an example:

ICON IDR_MAIN_ICON ICON "main_icon.ico"
ICON IDI_SMALL ICON "small_icon.ico"

Using RC Files in an Application

To use the resources defined in an RC file within an application, the RC file needs to be compiled into a binary format called a resource object file (RES file). This can be done using the resource compiler tool (RC.exe) provided by Microsoft.

The resulting RES file can then be linked with the application’s source code during the build process. The application can access the resources using their identifiers defined in the RC file.

For example:

// Load main menu
SetMenu(hWnd, hMenu);

// Load dialog
HWND hDialog = CreateDialog(hInstance, MAKEINTRESOURCE(IDD_DIALOG), hWndParent, DialogProc);
ShowWindow(hDialog , SW_SHOW);


RC files provide a convenient way to define and manage resources for Windows applications. By separating the resources from the application’s source code, it allows for easier localization, customization, and maintenance of the application’s user interface.

Remember to follow the proper structure when creating RC files and utilize the various sections available to define menus, dialogs, icons, and other resources effectively.

Discord Server - Web Server - Private Server - DNS Server - Object-Oriented Programming - Scripting - Data Types - Data Structures

Privacy Policy