Share via


Watch Window (Windows CE 5.0)

Send Feedback

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.

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.

If you add an array, an object, or a structure variable to the Watch window, plus (+) or minus (–) boxes appear in the Name column. You can use these boxes to expand or collapse your view of the variable.

If the value of a variable appears in red, the value has recently changed. Only the last value to change appears in red.

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.

In addition to global variables of the current process, if you qualify the name with the context operator, you can also review global variables of any loaded module.

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 

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

  • Context menu
    Right-click the window to bring up a context menu, which contains the following functions:
    Item Description
    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.
    Properties Opens the Program Variable Properties Dialog Box dialog box.

See Also

Character Formatting of Watch Variables | Program Variable Properties Dialog Box | Viewing the Value of a Variable or Expression or the Contents of a Register in the Watch Window

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.