Click to Rate and Give Feedback
MSDN
MSDN Library
Core OS Services
Core OS Reference
Debugging Reference
Debugging Macros
 DEBUGMSG

  Switch on low bandwidth view
DEBUGMSG
Windows Mobile SupportedWindows Embedded CE Supported
8/28/2008

This macro conditionally outputs a debugging message.


DEBUGMSG (
    Condition,
  Printf_expr
) 
Condition

Boolean expression that is used to determine whether the message would be output.

Printf_expr

A printf-style expression to be output. Must be enclosed in parentheses. Will be passed on to the NKDbgPrintf function.

None.

This macro is a wrapper around NKDbgPrintfW that uses a subset of printf formatting characters to format debugging message output.

This macro may be used to conditionally output a debugging message formatted in printf style. The printf-style message parameter is output if the Boolean input expression evaluates to TRUE. Note that the parameter Message must be enclosed by parentheses to prevent syntax errors being generated by the preprocessor.

 DEBUGMSG(TRUE, (TEXT("Testing item count against maximum %u\r\n"),
         dwMaxNumberOfItems));
 DEBUGMSG(dwCurrentNumberOfItems >= dwMaxNumberOfItems,
          (TEXT("Invalid item count! Found %u, expected less than %u\r\n"),
           dwCurrentNumberOfItems, dwMaxNumberOfItems));

Output:

 Testing item count against maximum 68
 Invalid item count! Found 343, expected less than 68
Headerdbgapi.h
Windows Embedded CEWindows CE 2.10 and later
Windows MobileWindows Mobile Version 5.0 and later
Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker