Set Syntax Coloring for User-Defined Keywords | CodeGuru

Set Syntax Coloring for User-Defined Keywords

Environment: Algorithms, Visual C++ This tip was proposed by Sairama Jamalapuram. Syntax coloring for user-defined keywords is used for C++ files only. Here are the steps you need to take to enable syntax coloring for user-defined keywords. The steps are taken from the online help. In the same directory as msdev.exe (for Visual Studio .Net […]

Written By
CodeGuru Staff
CodeGuru Staff
Aug 11, 2003
2 minute read
CodeGuru content and product recommendations are editorially independent. We may make money when you click on links to our partners. Learn More

Environment: Algorithms, Visual C++

This tip was proposed by Sairama Jamalapuram. Syntax coloring for user-defined keywords is used for C++ files only.

Here are the steps you need to take to enable syntax coloring for user-defined keywords. The steps are taken from the online help.

  1. In the same directory as msdev.exe (for Visual Studio .Net search for …Microsoft Visual Studio.NETCommon7IDEdevenv.exe), use the Text editor or Windows Notepad to create a text-only
    file named usertype.dat.
  2. Add your keywords to usertype.dat, one keyword per line. Note: The usertype.dat file is read during initialization. It cannot be renamed, nor can it be reloaded during an editing session. The syntax coloring mechanism checks the usertype.dat file last. Thus, all previously defined color settings take precedence over the user-defined keywords.
  3. Save the file as a text-only file, exit, and then restart Visual Studio.
  4. From the Tools menu, choose Options.
  5. Select the Format tab.
  6. In the Colors box, select User Defined Keywords.
  7. Set the font, font size, foreground color, and background color to your preferences.
  8. Click OK.
  9. Restart DevStudio.

This tip requires you to create a text file with the keywords. This can mean a lot of typing, so I created one from the MFC browse file. This is a huge file but surprisingly DevStudio doesn’t seem to be any slower. I do have 128 Mb RAM, though. The USERTYPE.DAT file I created contains all the symbols used by MFC including the Windows functions, Windows constants such as messages and styles, MFC classes and member functions, and a whole lot of other identifiers I don’t even recognize. Feel free to trim down the file if you want.

Downloads

Download keyword file. This file is 181 Kb zipped and expands to 638 Kb.

Date Last Updated: August 11, 2003 ISO C99: 7.18 Integer types

CodeGuru Logo

CodeGuru covers topics related to Microsoft-related software development, mobile development, database management, and web application programming. In addition to tutorials and how-tos that teach programmers how to code in Microsoft-related languages and frameworks like C# and .Net, we also publish articles on software development tools, the latest in developer news, and advice for project managers. Cloud services such as Microsoft Azure and database options including SQL Server and MSSQL are also frequently covered.

Property of TechnologyAdvice. © 2026 TechnologyAdvice. All Rights Reserved

Advertiser Disclosure: Some of the products that appear on this site are from companies from which TechnologyAdvice receives compensation. This compensation may impact how and where products appear on this site including, for example, the order in which they appear. TechnologyAdvice does not include all companies or all types of products available in the marketplace.