Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Showing tooltips for your own class types

Status
Not open for further replies.

KeithBrautigam

Programmer
Nov 4, 2000
71
US
This tip is nothing new, but it's useful enough that I decided to post it in the hope that many others will find it helpful, just as I have.

In the Visual C++ debugger, you can get tool tips for the built-in types and for many MFC classes by simply holding the mouse pointer over a variable. However, when you hold the mouse over an object of one of your own class types, you typically get "{...}".

You can teach VC++ what to display for your own class types by modifying a text file called "autoexp.dat". On my system, this file was found in the "C:\Program Files\Microsoft Visual Studio\Common\MSDev98\Bin" directory. The file has many helpful comments in it to explain how it can be modified.

As an example, say I have a class that associates a number and a unit, as follows:

class CDimension
{
public:
CDimension( double dValue, const CString& rsUnitAbb );

// pretend there's other member functions here...

private:
double m_dValue;
CString m_sUnitAbb; // unit abbreviation
};

Then I could add the following line to AutoExp.dat:
CDimension=<m_dValue,g> <m_sUnitAbb.m_pchData,st>

If I, in some other code, have a line such as this:
const CDimension* pdimRadius = GetRadius( );

Then if I had a breakpoint on the line following that, I could hold the mouse over pdimRadius to see both the value and the unit associated with it.

Note that you have to exit and restart VC++ for any &quot;AutoExp.dat&quot; changes to take effect.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top