次の方法で共有


Symbol Name Restrictions

OverviewHow Do I

All symbol names must be unique within the scope of the application. This prevents conflicting symbol definitions in the header files. Allowed 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 are not case sensitive, but the case of the first symbol definition is preserved.

Symbol names can be used more than once in your application. For example, if you are writing a data-entry program with several dialog boxes containing a text box for a person’s Social Security number, you may want to give all the related text boxes a symbol name of IDC_SSN. To do this, you can define a single symbol and use it as many times as needed.

Although it is not required, symbol names are often given descriptive prefixes that indicate the kind of resource or object they represent. 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 resources)
Dialog box
Cursor
Icon
Bitmap
Menu items IDM_ Menu item
Commands ID_ Command
Controls and child windows IDC_ Control
Strings IDS_
IDP_
String in the string table
String-table string used for message boxes