16,472
社区成员
发帖
与我相关
我的任务
分享
CString strMyString = _T("abc");
当我们单步步过上行代码的时候,鼠标指向变量strMyString,将显示class xString : public CString
{
public:
xString ( void ) {}
xString ( const TCHAR * szString )
{
CString::operator = ( szString );
}
};
xString strMxString = _T("abc");
鼠标指向变量strMxString(调试),将显示[DebuggerDisplay("{GetData()}")]
class xString : public CString
{
public:
xString ( void ) {}
xString ( const TCHAR * szString )
{
CString::operator = ( szString );
}
};
xString strMxString = _T("abc");
type=$ADDIN(dllname.dll,exportname)
exportname不能使用动态的名字,所以除了能实现自定义的内容外,类名还是得提前定义下来,依然要去修改AutoExp文件,只是解决了手动修改之后的问题,手动修改这个问题还是个大麻烦class xString : public CString
{
public:
xString ( void ) {}
xString ( const TCHAR * that )
{
CString::operator=(that);
}
};
void TestIt ( void )
{
// Test...
CString strTestVal1;
xString strTestVal2;
strTestVal1 = _T("abc");
strTestVal2 = _T("abc");
}
然后修改autoexp.dat,在CStringT的后面x入
ANSI版:
xString{
preview ([$e.m_pszData,s])
stringview ([$e.m_pszData,sb])
}
UNICODE版:
xString{
preview ([$e.m_pszData,su])
stringview ([$e.m_pszData,sub])
}
问题虽然解决了,但是:
1)AutoExp无法判断是显示ANSI还是UNICODE的字符串,所以要写两个AutoExp表达式,根据编译选项,手动去改AutoExp文件;或者,使用模板,就像AutoExp里的CStringT等一样,但是这得修改代码,很容易引入新BUG,不可取;
2)AutoExp不能在调试的过程中修改,在调试过程中,AutoExp文件是写占用的;
3)每次去安装目录下手动改文件很是麻烦,如果写个插件的话,感觉可能是想的简单实现起来麻烦;到是可以写个简单的对话框程序,手动选几个选项然后写AutoExp文件,总觉得怪怪的。
求解惑~CString strTestVal1;
xString strTestVal2;
strTestVal1 = _T("abc");
strTestVal2 = _T("abc");