Книга: Microsoft Windows Embedded CE 6.0 Exam Preparation Kit

Zone Definitions

Zone Definitions

The sample code above registers six debug zones for the module that you can now use in conjunction with conditional statements in debugging macros. The following line of code shows one possible way to do this:

DEBUGMSG(dpCurSettings.ulZoneMask & (0x00000001<<(15)),
 (TEXT("Error Informationrn")));

If the debug zone is currently set to MASK_ERROR, the conditional expression evaluates to TRUE and DEBUGMSG sends the information to the debug output stream. However, to improve the readability of your code, you should use the DEBUGZONE macro defined in Dbgapi.h, as illustrated in the following code snippet, to define flags for your zones. Among other things, this approach simplifies the combination of debug zones through logical AND and OR operations.

#include <DBGAPI.H>
// Definition of zone flags: TRUE or FALSE according to selected debug zone.
#define ZONE_INIT    DEBUGZONE(0)
#define ZONE_DEINIT  DEBUGZONE(1)
#define ZONE_ON      DEBUGZONE(2)
#define ZONE_FAILURE DEBUGZONE(13)
#define ZONE_WARNING DEBUGZONE(14)
#define ZONE_ERROR   DEBUGZONE(15)
DEBUGMSG(ZONE_FAILURE, (TEXT("Failure debug zone enabled.rn")));
DEBUGMSG(ZONE_FAILURE && ZONE_ WARNING,
 (TEXT("Failure and Warning debug zones enabled.rn")));
DEBUGMSG(ZONE_FAILURE || ZONE_ ERROR,
 (TEXT("Failure or Error debug zone enabled.rn")));

Оглавление книги


Генерация: 0.051. Запросов К БД/Cache: 0 / 0
поделиться
Вверх Вниз