Syntax highlighting for User-Defined Keywords

shabbir's Avatar author of Syntax highlighting for User-Defined Keywords
This is an article on Syntax highlighting for User-Defined Keywords in C++.
You can add words to be highlighted in the IDE of Visual Studio 6, 2003 and 2005.

Steps (From MSDN)

  1. In the same directory as msdev.exe (for Visual Studio .Net search for ...\Microsoft Visual Studio.NET\Common7\IDE\devenv.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.

Limitation



Syntax coloring for user-defined keywords is used for C++ project files only like cxx and .h files.

Use



With Large no of Macros and Windows function that you use in MFC its good to put them all in the file and set a different colour for them. This helps in writing the program and know what are the MFC/SDK function you are using.

I have added all the Windows message MACROS in the usertype.dat file attahced with the article. You can download the file and when ever you use any API or SDK function you can update it to make it complete.
Attached Files
File Type: zip usertype.zip (2.1 KB, 27 views)
aisha.ansari84's Avatar, Join Date: Feb 2008
Contributor
got the thing
rahul.mca2001's Avatar, Join Date: Feb 2008
Ambitious contributor
got it