次の方法で共有


Watch Window (Compact 2013)

3/26/2014

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. To display the window, go to Debug > Windows > Watch.

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 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 
    

    For more information about the syntax for context operators, see Breakpoints Window.

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.

The following table displays the available shortcut menu options in the Watch window.

  • Copy
    Copies the selected text.
  • Copy Expression
    Copies the selected Expression.
  • Copy Value
    Copies the selected value.
  • Cut
    Cuts the selected text.
  • 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.

See Also

Concepts

Platform Builder User Interface

Other Resources

Platform Builder Windows