KeithBrautigam
Programmer
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 "AutoExp.dat" changes to take effect.
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 "AutoExp.dat" changes to take effect.