开发者

Visual Studio 2010 C++ CLR Debugging Windows: How to override 'Value' part?

I did a research on web and cannot find anything so maybe you know a way to solve my problem. I am using MS VS 2010, and I use VS C++ (only CLR).. Let's say I have a class smt like this:

class A
{
public:
int x;
float a;
char* str;
};

While debugging my application, I open "Locals Window" and I see my variable name, value and Type. I would like to change (write) something to my value part. Like I habe a class A object a:

Name          Value                             Type
a             x: 4  a: 2.03f  str: 'Hello!'     A

I hope this was开发者_如何学运维 a clear example. I want to override value part in locals, autos ... windows.. Any way to do it?

Thanks...


If the class is a managed class then you can decorate it with a DebuggerDisplayAttribute. If it is unmanaged, which your example seems to be, then you need to edit a file called autoexp.dat. There's a fairly old article on MSDN about it here, I have done this a long time ago and remember it was a pain to get working. Also, there is a bug filed on Connect that autoexp.dat doesn't work for C++/CLI projects in VS 2010, though I haven't tried this myself.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜