ChefZ -- 磨劍錄 (A Coder's Log)

慣看秋月春風 一壺濁酒喜相逢 古今多少事 皆賦談笑中
posts - 42, comments - 3, trackbacks - 0, articles - 6

Automatically showing wxStrings contents in debug windows

If you are debugging your program, wxString variables show up in the debug windows in the form:
[+] Variable   {...}

You first have to click on the [+] sign to expand the structure. Then you see the m_pchData variable, which is the pointer to the actual data.

I found this to be annoying and looked for a solution. There is a very interesting file called AUTOEXP.DAT, which does exactly what I wanted.

  1. Locate and open a file called AUTOEXP.DAT. Its in the \Program Files\Microsoft Visual Studio\Common\MSDev98\Bin directory, if you are using Version 6. Search for it if you are using .NET Studio.
  2. Add the following line to the [autoexpand] section (or the bottom of the file). With .NET 2003 be careful not to put it in the [hresult] section!:
    wxString=<m_pchData,st>
  3. Restart Visual Studio.

That’s all. Now, when you are debugging and displaying a string, the wxString variable shows up in the form:
[+] Variable   {“Contents of the string”}

This will save you many mouseclicks, especially when you want to watch the changes to this variable. And while you are at it, read the comments in AUTOEXP.DAT. I am sure you can think of more variables you’d like to handle this way.

While you are at it editing autoexp.dat...


只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   知识库   博问   管理