WINERR.H
[目次 | マクロ]
1|/**************************************************************************
2| 1. <<< Windows API エラーコード (WinErr) >>>
3|***************************************************************************/
4|
5|#ifndef __WINERR_H
6|#define __WINERR_H
7|
8|
9|/*************************************************************************
10| 2. <<< モジュール設定・優先ヘッダ >>>
11|**************************************************************************/
12|#ifndef USES_PRIORITY_HEADER
13|/*[START_OF_PRIORITY_HEADER]*/
14|
15|#ifndef USES_WINERR
16|#define USES_WINERR
17|
18|#define WINERR_USE_DDRAW /* D:\mssdk\include\ddraw.h or D:\Program Files\Microsoft Visual Studio\VC98\Include\DDRAW.H */
19|
20|#endif
21|
22|/*[END_OF_PRIORITY_HEADER]*/
23|#endif
24|
25|
26|/*************************************************************************
27| 3. <<< エラーコード, リターンコード >>>
28|**************************************************************************/
29|
30|#define WinErr_Err_Some 0
31|
32|
33|/*--------------------------------------------------------------*/
34|/*4. <<< Interface Area -------------------------------------- >>> */
35|/*--------------------------------------------------------------*/
36|
37|#ifdef __cplusplus
38|extern "C" {
39|#endif
40|
41|
42|/**************************************************************************
43| 5. <<< [WinErr] Windows API エラーコード >>>
44|***************************************************************************/
45|
46|/* WinErr_ASSERT( int code ); */
47|char* WinErr_getSym( int code );
48|char* WinErr_getMsg( int code );
49|
50|
51|/* 以下は内部用 */
52|void WinErr_assert_imp( int code, char* file, int line );
53|
54|
55|/**************************************************************************
56| 6. <<< 基本型のデバッグ表示 >>>
57|***************************************************************************/
58|
59|void WinErr_RECT_print( RECT*, const char* title );
60|
61|#ifdef __cplusplus
62|}
63|#endif
64|
65|/*--------------------------------------------------------------*/
66|/*7. <<< Mapping Area ---------------------------------------- >>> */
67|/*--------------------------------------------------------------*/
68|
69|
70|/**************************************************************************
71| 8. <<< [WinErr_ASSERT] Windows API のエラーコードをチェックする >>>
72|【引数】
73| ・int cond; 成功条件
74| ・HRESULT/DWORD code; Windows API エラーコード、返り値、GetLastError()
75|【補足】
76|・HRESULT 型を返す関数では、次のように使用します。
77| HRESULT hr;
78| hr = lpdds->GetDC( ... );
79| WinErr_ASSERT( hr == DD_OK, hr );
80|
81|・BOOL 型を返す関数では、次のように使用します。
82| BOOL r;
83| r = CreateWindowEx( ... );
84| WinErr_ASSERT( r != 0, GetLastError() );
85|
86|・c:\Program Files\Microsoft Visual Studio\VC98\Include\WINERROR.H などを参考
87|***************************************************************************/
88|#define WinErr_ASSERT( cond, code ) \
89| if ( !(cond) ) WinErr_assert_imp( code, __FILE__, __LINE__ )
90|
91|
92|#endif /* __WINERR_H */
93|
94|