QuickWatch Dialog Box

Other versions of this page are also available for the following:

Windows Mobile SupportedWindows Embedded CE Supported

8/27/2008

The QuickWatch menu item is available when you are at a break state when debugging a project.

The QuickWatch dialog box enables you to do the following:

  • Examine the value of a variable or expression.
  • Modify the value of a variable or to add a variable or expression to the Watch window.

The Current Value spreadsheet field displays only one variable or expression at a time. Click these boxes to expand or collapse your view of the variable.

  • If you type a new variable or expression in the text box, and then press ENTER, the previous variable or expression in the Current Value field is replaced.
  • If you type a scalar variable or expression in the text box, the QuickWatch dialog box displays the result on the first line of the spreadsheet.
  • If you type an array, an object, or a structure variable, the QuickWatch dialog box uses the spreadsheet to show additional detail. Plus (+) and minus (-) boxes appear.

If the variable is an object, a reference, or a C++ pointer to an object, the QuickWatch dialog box expands the variable to show the most important data at the top level.

If the variable is a C++ pointer or reference to an object, the QuickWatch dialog box downcasts the reference or pointer.

The QuickWatch dialog box adds an extra member that looks like another base class to the expanded object. This extra member indicates the derived subclass.

For example, if a variable that is declared as a C++ pointer to CObject points to CComboBox, the QuickWatch dialog box recognizes this and adds an extra member so you can access the CComboBox members.

The QuickWatch dialog box displays values in their default format. You can change the display format — for example, to display Unicode characters — by using formatting characters.

The dialog box includes the following items.

  • IDE Procedures
    Use to view the value of a variable, or expression, or the contents of a register..
  • Expression
    Use to type the variable or expression to display or modify, or select it in your project's .cpp file and then open the QuickWatch window.
  • Name
    Use to see the name of the expression you selected in the Expression text box.

    If you selected hexadecimal display in the Tools Option window Debug tab, you must enter your input in hexadecimal or use the prefix 0n (zero-n) to indicate that the number is a decimal, such as 0n1000.

  • Value
    Use to see the current value of the expression you selected in the Expression text box.
  • Recalculate
    Select to calculate the value of an expression in the Expression text box, and display the result into the Current Value text box.

    • If you have typed the expression, select Recalculate to display the value of that expression.
    • If you selected the expression from your project .cpp file, the value is calculated when you open the QuickWatch window.
      To recalculate, select the line in the Current Value box that you want to recalculate and select Recalculate.
  • Add Watch
    Use to add the variable or expression to the Watch window.

    If the Watch window is not displayed, Add Watch also displays the window.

  • Close
    Use to close the dialog box without saving changes.

See Also

Tasks

Handling an Exception

Concepts

Viewing Debug Information in the Debug Windows