Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1 | pmbaty | 1 | /*==========================================================================; |
2 | * |
||
3 | * |
||
4 | * File: dxerr.h |
||
5 | * Content: DirectX Error Library Include File |
||
6 | * |
||
7 | ****************************************************************************/ |
||
8 | |||
9 | #ifndef _DXERR_H_ |
||
10 | #define _DXERR_H_ |
||
11 | |||
12 | #ifdef __cplusplus |
||
13 | extern "C" { |
||
14 | #endif //__cplusplus |
||
15 | |||
16 | // |
||
17 | // DXGetErrorString |
||
18 | // |
||
19 | // Desc: Converts a DirectX HRESULT to a string |
||
20 | // |
||
21 | // Args: HRESULT hr Can be any error code from |
||
22 | // XACT XAUDIO2 XAPO XINPUT DXGI D3D10 D3DX10 D3D9 D3DX9 DDRAW DSOUND DINPUT DSHOW |
||
23 | // |
||
24 | // Return: Converted string |
||
25 | // |
||
26 | const char* WINAPI DXGetErrorStringA(__in HRESULT hr); |
||
27 | const WCHAR* WINAPI DXGetErrorStringW(__in HRESULT hr); |
||
28 | |||
29 | #ifdef UNICODE |
||
30 | #define DXGetErrorString DXGetErrorStringW |
||
31 | #else |
||
32 | #define DXGetErrorString DXGetErrorStringA |
||
33 | #endif |
||
34 | |||
35 | |||
36 | // |
||
37 | // DXGetErrorDescription |
||
38 | // |
||
39 | // Desc: Returns a string description of a DirectX HRESULT |
||
40 | // |
||
41 | // Args: HRESULT hr Can be any error code from |
||
42 | // XACT XAUDIO2 XAPO XINPUT DXGI D3D10 D3DX10 D3D9 D3DX9 DDRAW DSOUND DINPUT DSHOW |
||
43 | // |
||
44 | // Return: String description |
||
45 | // |
||
46 | const char* WINAPI DXGetErrorDescriptionA(__in HRESULT hr); |
||
47 | const WCHAR* WINAPI DXGetErrorDescriptionW(__in HRESULT hr); |
||
48 | |||
49 | #ifdef UNICODE |
||
50 | #define DXGetErrorDescription DXGetErrorDescriptionW |
||
51 | #else |
||
52 | #define DXGetErrorDescription DXGetErrorDescriptionA |
||
53 | #endif |
||
54 | |||
55 | |||
56 | // |
||
57 | // DXTrace |
||
58 | // |
||
59 | // Desc: Outputs a formatted error message to the debug stream |
||
60 | // |
||
61 | // Args: CHAR* strFile The current file, typically passed in using the |
||
62 | // __FILE__ macro. |
||
63 | // DWORD dwLine The current line number, typically passed in using the |
||
64 | // __LINE__ macro. |
||
65 | // HRESULT hr An HRESULT that will be traced to the debug stream. |
||
66 | // CHAR* strMsg A string that will be traced to the debug stream (may be NULL) |
||
67 | // BOOL bPopMsgBox If TRUE, then a message box will popup also containing the passed info. |
||
68 | // |
||
69 | // Return: The hr that was passed in. |
||
70 | // |
||
71 | HRESULT WINAPI DXTraceA( __in_z const char* strFile, __in DWORD dwLine, __in HRESULT hr, __in_z_opt const char* strMsg, __in BOOL bPopMsgBox ); |
||
72 | HRESULT WINAPI DXTraceW( __in_z const char* strFile, __in DWORD dwLine, __in HRESULT hr, __in_z_opt const WCHAR* strMsg, __in BOOL bPopMsgBox ); |
||
73 | |||
74 | #ifdef UNICODE |
||
75 | #define DXTrace DXTraceW |
||
76 | #else |
||
77 | #define DXTrace DXTraceA |
||
78 | #endif |
||
79 | |||
80 | |||
81 | // |
||
82 | // Helper macros |
||
83 | // |
||
84 | #if defined(DEBUG) | defined(_DEBUG) |
||
85 | #define DXTRACE_MSG(str) DXTrace( __FILE__, (DWORD)__LINE__, 0, str, FALSE ) |
||
86 | #define DXTRACE_ERR(str,hr) DXTrace( __FILE__, (DWORD)__LINE__, hr, str, FALSE ) |
||
87 | #define DXTRACE_ERR_MSGBOX(str,hr) DXTrace( __FILE__, (DWORD)__LINE__, hr, str, TRUE ) |
||
88 | #else |
||
89 | #define DXTRACE_MSG(str) (0L) |
||
90 | #define DXTRACE_ERR(str,hr) (hr) |
||
91 | #define DXTRACE_ERR_MSGBOX(str,hr) (hr) |
||
92 | #endif |
||
93 | |||
94 | |||
95 | #ifdef __cplusplus |
||
96 | } |
||
97 | #endif //__cplusplus |
||
98 | |||
99 | #endif // _DXERR_H_ |