Partager via


Create Debug Messages That Use Debug Zones (Compact 2013)

3/26/2014

To create debug messages that are sent to the output stream only when a particular debug zone is active, use a debug message macro such as DEBUGMSG.

Note

You typically only use debug zones with the debug message macros DEBUGMSG, ERRORMSG, and ASSERTMSG because dpCurSettings is typically only compiled into the library if the module is built in a Debug configuration. When you use RETAILMSG, you typically set the first argument to 1 so that the condition is always set to True.

To create debug messages that use debug zones

  1. To add a debug message to your code:

    • Use a debug macro based on the build types in which you want the message to be sent to the output stream.
      For more information, see Add Debug Messages.

    • Use the debug zone as the first argument of the debug message macro.
      This example shows a debug message that is only sent to the output stream when ZONE_ERROR is active.

      DEBUGMSG (ZONE_ERROR, (TEXT("This is a sample error message.")));
      
  2. To add a message for multiple debug zones, OR the zones together to create the condition.

    This example shows a debug message that is sent to the output stream when either ZONE_INFO or ZONE_TRACE is active.

    DEBUGMSG (ZONE_INFO | ZONE_TRACE, (TEXT("This is a sample error message.")));
    

See Also

Concepts

Use Debug Zones
Kernel Debugger
Debugging

Other Resources

Windows Embedded Compact 2013