Search This Blog

Saturday, October 31, 2009

To view all values and size of CStringArray in watch window

In watch window, we cannot view all the elements in a CStringArray .
We can view only the first element of the CStringArray.


To View all elements Please change the following settings [For Visual Studio 2008]:
1. Open the file "c:\Program Files\Microsoft Visual Studio 9.0\Common7\Packages\Debugger\autoexp.dat" in notepad

2. Search for the line "[AutoExpand]" add the following line.

[AutoExpand]
CStringArray=size = <m_nSize> //Add this line


3. Search for the line "[Visualizer]" add the following line.

[Visualizer] //Add the below lines after this line

CStringArray{
children
(
#array
(
expr : ($e.m_pData[$i]),
size : ($e.m_nSize)
)
)
}

4. Save this file and close All Visual studio application and open again and try.