Partager via


Symbol Name Restrictions

The restrictions on symbol names are as follows:

  • All symbols must be unique within the scope of the application. This prevents conflicting symbol definitions in the header files.

  • Valid characters for a symbol name include A-Z, a-z, 0-9, and underscores ( _ ).

  • Symbol names cannot begin with a number and are limited to 247 characters.

  • Symbol names cannot contain spaces.

  • Symbol names are not case sensitive, but the case of the first symbol definition is preserved. The header file that defines the symbols is used by both the resource compiler/editor and C++ program(s) to refer resources defined in a resource file. For two symbol names that differ only in case, the C++ program will see two separate symbols while the resource compiler/editor will see both names as referring to one single symbol.

    Note

    If you do not follow the standard symbol name scheme (ID*_[keyword]) outlined below, and your symbol name happens to be the same as a keyword known to the resource script compiler, trying to build the resource script file will result in seemingly random error generation that is difficult to diagnose. To prevent this, adhere to the standard naming scheme.

Symbol names have descriptive prefixes that indicate the kind of resource or object they represent. These descriptive prefixes begin with the text combination ID. The Microsoft Foundation Class Library (MFC) uses the symbol naming conventions shown in the following table.

Category

Prefix

Use

Resources

IDR_ IDD_ IDC_ IDI_ IDB_

Accelerator or menu (and associated or custom resources) Dialog box Cursor Icon Bitmap

Menu items

ID_

Menu item

Commands

ID_

Command

Controls and child windows

IDC_

Control

Strings

IDS_

String in the string table

MFC

AFX_

Reserved for predefined MFC symbols

For information on adding resources to managed projects, please see Resources in Applications in the .NET Framework Developer's Guide. For information on manually adding resource files to managed projects, accessing resources, displaying static resources, and assigning resources strings to properties, see Walkthrough: Localizing Windows Forms and Walkthrough: Using Resources for Localization with ASP.NET.

Requirements

Win32

See Also

Tasks

Changing a Symbol or Symbol Name (ID)

Reference

Symbol Value Restrictions

Predefined Symbol IDs