Share via


Viewing Variables for an Application

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

Windows Mobile SupportedWindows Embedded CE Supported

8/27/2008

The Variables Window provides quick access to variables that are important in the current context of the application.

The window includes three tabs:

  • The Auto tab displays the variables that are used in the current statement and in the previous statement.
  • The Locals tab displays the variables that are local to the current function.
  • The This tab displays the object that is pointed to by this.

About the Display Contents

Each tab contains a spreadsheet with fields for the variable name and value. The debugger fills in these fields.

  • If a value appears in red, it indicates that the value has recently changed. Only the last value to change appears in red.
  • You can change the value of a variable by left-clicking its Value field and entering new data. However, you cannot add variables or expressions to the Variables window. To add variables, you must use the Watch Window.
  • You can expand or collapse the variables that are shown by using the tree controls.
    If an array, object, or structure variable in the Variables window has a plus (+) box in the Name field, you can expand it.
    If an array, object, or structure variable has a minus (–) box in the Name field, the variable is already fully expanded.
  • If the variable is an object, a reference, or a C++ pointer to an object, the Variables window expands the variable to show the most important data at the top level. In addition, the Variables window adds an extra member to the expanded object. This extra member looks like another base class and indicates the derived subclass.
    For example, if a variable that is declared as a C++ pointer to CObject really points to a CComboBox, the Variables window adds an extra member so you can access the CComboBox members.
  • If the variable is a reference or a C++ pointer to an object, the Variables window downcasts the reference or pointer.

Aa936372.collapse(en-US,WinEmbedded.60).gifVariables Window Context List

In addition to tabs, the Variables window has a context box on the toolbar that contains a copy of the current call stack in a drop-down list box. Use this Context list to specify the current scope of the variables that are displayed.

  • You can hide the Context list by right-clicking the Variables window and then clearing the Toolbar check box.
  • You can navigate to a function's source code or disassembled object code from the Context list.
    This procedure displays the function's source code, if available, in a source window. If source code for the selected function is not available, it displays the function's object code in the Disassembly window.
    This procedure changes how the view of the program is displayed in the Variables window and other debugger windows, but does not change the next line of execution nor the value that is stored in the program counter.

See Also

Tasks

Viewing a Variable in the Variables Window

Concepts

Viewing Debug Information in the Debug Windows