If a pointer to an array only expands to a single item, the undocumented numerical format specifier will force the expansion. For example, if you have a LPDWORD pointer, pVals, that points to an array of 10 items, you can display all ten by entering "pVals,10" in the watch window. The number after the comma tells the watch window how many items to display.
- 显示GetLastError的值及其对应的说明(原文出处:Programming Applications for Microsoft Windows / Jeffrey Richter)
you can configure the Watch window to always show you the thread's last error code number and the English text description of the error. This is done by selecting a row in the Watch window and typing "@err,hr".
The Visual C++ debugger has a very cool and seemingly undocumented AutoExpand feature. The AutoExpand allows the Variables window to automatically show the pertinent data for the different types in their commonly used format. For example, a CRect variable is automatically expanded to show each of the member fields. The file that controls autoexpansion is AUTOEXP.DAT, located in the MSDEV/Shared IDE/BIN directory. The comments at the top of the file list all of the rules for adding new types to the file. The format specifier section shows the items that can be used directly in the Variables window or Watch window. Some of the more useful items are: s to show strings, su to expand Unicode strings, and c to show character values. To use a format specifier, type in the variable or value followed by a comma, then the format specifier. For example, m_strData,su would view the value as a Unicode string. You can also use C/C++ cast operations in the Variables window or Watch Window to view different items. To view the value at address 0x00404410 as a character string, type in (char*)0x404410.