Watch Window

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

Windows Mobile SupportedWindows Embedded CE Supported

8/27/2008

Use the Watch window to specify the variables and expressions you want to watch while debugging your program. You can also modify the value of a variable in the Watch window.

The Watch window contains four tabs: Watch1, Watch2, Watch3, and Watch4. Each tab displays a user-specified list of variables and expressions in a spreadsheet field. If the value of a variable appears in red, the value has recently changed. Only the last value to change appears in red.

Using this dialog box, you can:

  • Group variables you want to watch onto the same tab. For example, you could put variables related to a specific window on one tab and variables related to a dialog box on another tab. You could watch the first tab when debugging the window and the second tab when debugging the dialog box.

  • Use plus (+) or minus (–) boxes to expand or collapse your view of a variable, if you add an array, an object, or a structure variable to the Watch window.

  • Review global variables of any loaded module by if you qualify the name with the context operator.
    The following code example shows a command you can type into a Watch window to examine the PROCARRAY structure in the kernel.

    {,,nk.exe}ProcArray 
    

Watching Object Variables

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

The following code example shows a C++ object.

CString String  =   {...}
char *   m_pchData =0x7ffdf000 "abc"
   int          m_nDataLength=4
   int          m_nAllocLength=1244628

Given this object, the Watch window displays the following string:

String  =   {"abc"}

If the variable is a reference or a C++ pointer to an object, the Watch window downcasts the reference or pointer. The Watch window adds an extra member to the expanded object. This extra member, which looks like another base class, indicates the derived subclass.

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

The Watch window displays values in their default format. You can change the display format by using formatting characters. For example, you can display Unicode characters.

The Watch window does not display variable type information. You can view information for a variable type by using the window's property page.

  • Paste
    Pastes content placed on the clipboard into the next slot of the current tab.
  • Hexadecimal Display
    Changes the way integers are displayed:

    Turn this option on to display integers, signed and unsigned, in hexadecimal.

    Turn this option off to display all integers in decimal.

  • Docking View
    Switches the active window from docking to nondocking mode.

    • Docking mode. When a window is in docking mode, a check mark appears. You can dock the window to the border of the main Platform Builder window, or you can change the window to a floating window that can be moved outside the main Platform Builder window.
    • To change the window to a floating window, hold the CTRL key and click on the frame of the window that you select. This window can be redocked at any time.
    • Nondocking mode. If the window is in nondocking mode, it only appears inside the main Platform Builder window and cannot be docked.
  • Hide
    Hides the Watch window.

See Also

Tasks

Viewing a Value in the Watch Window

Concepts

Character Formatting of Watch Variables