How to: Define Keywords in Visual C++ 

Keywords are predefined reserved identifiers that have special meanings. They cannot be used as identifiers in your program; however, you can define your own keywords to use in Visual C++, and you can assign customized syntax coloring to the keywords. Syntax coloring gives you visual cues about the structure and state of your code.

To define your own Visual C++ keywords

  1. Using the Visual Studio Code and Text Editor or Windows Notepad, create a text-only file and save it with the name, usertype.dat.

  2. In the file, usertype.dat, type each keyword on a separate line.

  3. Save usertype.dat in the same directory as devenv.exe, as a text-only file.

  4. Exit and restart Visual Studio.

    Note

    You cannot rename or reload the usertype.dat file during an editing session because it is read during initialization. All previously defined color settings take precedence as the syntax coloring mechanism checks the usertype.dat file last.

  5. In the Tools Options dialog box, in the Display items box, select User keyword.

  6. Set the font and color properties for the new keywords as described in Fonts and Colors, Environment, Options Dialog Box.

For more information, see C++ Keywords in the C++ Language Reference.

See Also

Concepts

Running as a Member of the Users Group

Other Resources

Customizing the Development Environment
Shortcut Keys