Customizing the appearence of your own classes in debug windows
You may have noticed that for example CString instaces do not show up as `{...}4 in debug windows (watch, variable, etc. and in tooltip when you move the pointer on a variable). Rather, CString "smartly" shows up as `{"string"}4. This feature can be customized to make your own classes appear smartly while debugging, so that you can see the most crucial member varibles at first glance rather than having to expand the non-meaningful `{...}4 at first.
The definitions for the custom formatting reside in autoexp.dat in Common\MSDev98\Bin directory. The file has a fairly good documentation in it, and some good examples as well (including the CString one.) As with the usertype.dat (that has been dealt with in another article here), you'll have to restart MSVC to have the changes take effect.
This is a snippet from the file itself - it explains the syntax quite well.
; type=[text]For example, the line for CString is... ; ; type Name of the type (may be followed by <*> for template ; types such as the ATL types listed below). ; ; text Any text.Usually the name of the member to display, ; or a shorthand name for the member. ; ; member Name of a member to display. ; ; format Watch format specifier. One of the following: ; ; Letter Description Sample Display ; ------ -------------------------- ------------ ------------- ; d,i Signed decimal integer 0xF000F065,d -268373915 ; u Unsigned decimal integer 0x0065,u 101 ; o Unsigned octal integer 0xF065,o 0170145 ; x,X Hexadecimal integer 61541,X 0X0000F065 ; l,h long or short prefix for 00406042,hx 0x0c22 ; d, i, u, o, x, X ; f Signed floating-point 3./2.,f 1.500000 ; e Signed scientific-notation 3./2.,e 1.500000e+000 ; g Shorter of e and f 3./2.,g 1.5 ; c Single character 0x0065,c 'e' ; s Zero-terminated string 0x0012fde8,s "Hello world" ; su Unicode string 0x007200c4,su "Hello world" ; st String in ANSI or Unicode depending on current setting ; ; The special format <,t> specifies the name of the most-derived ; type of the object. This is especially useful with pointers or ; references to a base class. ; ; If there is no rule for a class, the base classes are checked for ; a matching rule.
CString =<m_pchData,st>If you have a class like this,
class Goo
{
int width;
double height;
char* name;
};
you might define the apperance as follows:
Goo =<name,s> width: <width,i> height: <height,g>which would result in the following outlook in the debug window:
{"a goo" width: 5 height: 3.1}
Date Last Updated: April 18, 1999

Comments
child window
Posted by Legacy on 05/21/2000 12:00amOriginally posted by: chandrika
hi
i want to know how to create a child window from a dialog box.
the appwizard what i've generated can open a dialog box.
when i click the ok button here it should popup a window.
thanks for suggestions
ReplyHow about CStringArray?
Posted by Legacy on 12/14/1999 12:00amOriginally posted by: robin
I still have a problem with CStringArray
ReplyRe: Displaying arrays
Posted by Legacy on 04/26/1999 12:00amOriginally posted by: Ville Herva
ReplyVisual C++ 5.0
Posted by Legacy on 04/22/1999 12:00amOriginally posted by: Philippe Lhoste
Also found autoexp.dat in DevStudio\SharedIDE\bin for Visual C++ 5.0
ReplyExtending the debug window even more...
Posted by Legacy on 04/22/1999 12:00amOriginally posted by: Rick Vestal
ReplyDoes anyone know what the $BUILTIN token does?
Posted by Legacy on 04/21/1999 12:00amOriginally posted by: Dave Leigh
Does anyone know what the $BUILTIN token does?
I would like to be able to alter the display string based on the state of the object. Is $BUILTIN the key to this?
Also, does anyone know how enumerated types are converted from integral values into strings?
Reply