DEBUG.H
资源名称:MSDN_VC98.zip [点击查看]
上传用户:bangxh
上传日期:2007-01-31
资源大小:42235k
文件大小:3k
源码类别:
Windows编程
开发平台:
Visual C++
- #ifndef DEBUG_H
- #define DEBUG_H
- /*
- **-----------------------------------------------------------------------------
- ** File: Debug.h
- ** Purpose: Sample Debug code
- ** Notes:
- **
- ** Copyright (c) 1995 - 1997 by Microsoft, all rights reserved
- **-----------------------------------------------------------------------------
- */
- /*
- **-----------------------------------------------------------------------------
- ** Include files
- **-----------------------------------------------------------------------------
- */
- #include "Common.h"
- /*
- **-----------------------------------------------------------------------------
- ** Defines
- **-----------------------------------------------------------------------------
- */
- #ifdef DEBUG
- // Note: Define DEBUG_PROMPT_ME if you want MessageBox Error prompting
- // This can get annoying quickly...
- // #define DEBUG_PROMPT_ME
- // Pre and Post debug string info
- #define START_STR TEXT ("BOIDS: ")
- #define END_STR TEXT ("rn")
- #endif // DEBUG
- // Debug Levels
- #define DEBUG_ALWAYS 0L
- #define DEBUG_CRITICAL 1L
- #define DEBUG_ERROR 2L
- #define DEBUG_MINOR 3L
- #define DEBUG_WARN 4L
- #define DEBUG_DETAILS 5L
- // Sample Errors
- #define APPERR_GENERIC MAKE_DDHRESULT (10001)
- #define APPERR_INVALIDPARAMS MAKE_DDHRESULT (10002)
- #define APPERR_NOTINITIALIZED MAKE_DDHRESULT (10003)
- #define APPERR_OUTOFMEMORY MAKE_DDHRESULT (10004)
- #define APPERR_NOTFOUND MAKE_DDHRESULT (10005)
- /*
- **-----------------------------------------------------------------------------
- ** Macros
- **-----------------------------------------------------------------------------
- */
- #ifdef DEBUG
- #define DPF dprintf
- #define ASSERT(x)
- if (! (x))
- {
- DPF (DEBUG_ALWAYS, TEXT("Assertion violated: %s, File = %s, Line = #%ldn"),
- TEXT(#x), TEXT(__FILE__), (DWORD)__LINE__ );
- abort ();
- }
- #define REPORTERR(x)
- ReportDDError ((x), TEXT("File = %s, Line = #%ldn"),
- TEXT(__FILE__), (DWORD)__LINE__ );
- #define FATALERR(x)
- ReportDDError ((x), TEXT("File = %s, Line = #%ldn"),
- TEXT(__FILE__), (DWORD)__LINE__ );
- OnPause (TRUE);
- DestroyWindow (g_hMainWindow);
- #else
- #define REPORTERR(x)
- #define DPF 1 ? (void)0 : (void)
- #define ASSERT(x)
- #define FATALERR(x)
- OnPause (TRUE);
- DestroyWindow (g_hMainWindow);
- #endif // DEBUG
- /*
- **-----------------------------------------------------------------------------
- ** Global Variables
- **-----------------------------------------------------------------------------
- */
- // Debug Variables
- #ifdef DEBUG
- extern DWORD g_dwDebugLevel;
- #endif
- extern BOOL g_fDebug;
- /*
- **-----------------------------------------------------------------------------
- ** Function Prototypes
- **-----------------------------------------------------------------------------
- */
- // Debug Routines
- #ifdef DEBUG
- void __cdecl dprintf (DWORD dwDebugLevel, LPCTSTR szFormat, ...);
- #endif //DEBUG
- void _cdecl ReportDDError (HRESULT hResult, LPCTSTR szFormat, ...);
- /*
- **-----------------------------------------------------------------------------
- ** End of File
- **-----------------------------------------------------------------------------
- */
- #endif // End DEBUG_H