1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Syntax highlighting for User-Defined Keywords

Discussion in 'C++' started by shabbir, Oct 1, 2006.

  1. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,287
    Likes Received:
    364
    Trophy Points:
    83
    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:

  2. aisha.ansari84

    aisha.ansari84 New Member

    Joined:
    Feb 13, 2008
    Messages:
    82
    Likes Received:
    1
    Trophy Points:
    0
  3. rahul.mca2001

    rahul.mca2001 New Member

    Joined:
    Feb 13, 2008
    Messages:
    103
    Likes Received:
    0
    Trophy Points:
    0

Share This Page