home *** CD-ROM | disk | FTP | other *** search
/ Chip 2004 May / CMCD0504.ISO / Software / Freeware / Programare / dspack / DSPACK231.exe / {app} / src / DirectX9 / dxerr9.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  2003-01-26  |  7.0 KB  |  151 lines

  1. {******************************************************************************}
  2. {*                                                                            *}
  3. {*  Copyright (C) Microsoft Corporation.  All Rights Reserved.                *}
  4. {*                                                                            *}
  5. {*  File:       dxerr9.h                                                      *}
  6. {*                                                                            *}
  7. {*  Content:    DirectX Error Library Include File                            *}
  8. {*                                                                            *}
  9. {*  DirectX 9.0 Delphi adaptation by Alexey Barkovoy                          *}
  10. {*  E-Mail: clootie@reactor.ru                                                *}
  11. {*                                                                            *}
  12. {*  Modified: 26-Jan-2003                                                     *}
  13. {*                                                                            *}
  14. {*  Latest version can be downloaded from:                                    *}
  15. {*     http://clootie.narod.ru/delphi                                         *}
  16. {*                                                                            *}
  17. {******************************************************************************)
  18. {                                                                              }
  19. { Obtained through: Joint Endeavour of Delphi Innovators (Project JEDI)        }
  20. {                                                                              }
  21. { The contents of this file are used with permission, subject to the Mozilla   }
  22. { Public License Version 1.1 (the "License"); you may not use this file except }
  23. { in compliance with the License. You may obtain a copy of the License at      }
  24. { http://www.mozilla.org/MPL/MPL-1.1.html                                      }
  25. {                                                                              }
  26. { Software distributed under the License is distributed on an "AS IS" basis,   }
  27. { WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for }
  28. { the specific language governing rights and limitations under the License.    }
  29. {                                                                              }
  30. { Alternatively, the contents of this file may be used under the terms of the  }
  31. { GNU Lesser General Public License (the  "LGPL License"), in which case the   }
  32. { provisions of the LGPL License are applicable instead of those above.        }
  33. { If you wish to allow use of your version of this file only under the terms   }
  34. { of the LGPL License and not to allow others to use your version of this file }
  35. { under the MPL, indicate your decision by deleting  the provisions above and  }
  36. { replace  them with the notice and other provisions required by the LGPL      }
  37. { License.  If you do not delete the provisions above, a recipient may use     }
  38. { your version of this file under either the MPL or the LGPL License.          }
  39. {                                                                              }
  40. { For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html }
  41. {                                                                              }
  42. {******************************************************************************}
  43.  
  44. unit dxerr9;
  45.  
  46. interface
  47.  
  48. {$HPPEMIT '#include "dxerr9.h"'}
  49.  
  50. uses
  51.   Windows;
  52.  
  53. (*==========================================================================;
  54.  *
  55.  *
  56.  *  File:   dxerr9.h
  57.  *  Content:    DirectX Error Library Include File
  58.  *
  59.  ****************************************************************************)
  60.  
  61. const
  62.   //////////// DLL export definitions ///////////////////////////////////////
  63.   dxerr9dll = 'dxerr9ab.dll';
  64.   {$EXTERNALSYM dxerr9dll}
  65.  
  66. //
  67. //  DXGetErrorString9
  68. //
  69. //  Desc:  Converts a DirectX 9 or earlier HRESULT to a string
  70. //
  71. //  Args:  HRESULT hr   Can be any error code from
  72. //                      D3D9 D3DX9 D3D8 D3DX8 DDRAW DPLAY8 DMUSIC DSOUND DINPUT DSHOW
  73. //
  74. //  Return: Converted string
  75. //
  76.  
  77. function DXGetErrorString9A(hr: HRESULT): PAnsiChar; stdcall; external dxerr9dll;
  78. {$EXTERNALSYM DXGetErrorString9A}
  79. function DXGetErrorString9W(hr: HRESULT): PWideChar; stdcall; external dxerr9dll;
  80. {$EXTERNALSYM DXGetErrorString9W}
  81.  
  82. function DXGetErrorString9(hr: HRESULT): PChar;  stdcall; external dxerr9dll
  83.   name {$IFDEF UNICODE}'DXGetErrorString9W'{$ELSE}'DXGetErrorString9A'{$ENDIF};
  84. {$EXTERNALSYM DXGetErrorString9}
  85.  
  86.  
  87. //
  88. //  DXGetErrorDescription9
  89. //
  90. //  Desc:  Returns a string description of a DirectX 9 or earlier HRESULT
  91. //
  92. //  Args:  HRESULT hr   Can be any error code from
  93. //                      D3D9 D3DX9 D3D8 D3DX8 DDRAW DPLAY8 DMUSIC DSOUND DINPUT DSHOW
  94. //
  95. //  Return: String description
  96. //
  97. function DXGetErrorDescription9A(hr: HRESULT): PAnsiChar; stdcall; external dxerr9dll;
  98. {$EXTERNALSYM DXGetErrorDescription9A}
  99. function DXGetErrorDescription9W(hr: HRESULT): PWideChar; stdcall; external dxerr9dll;
  100. {$EXTERNALSYM DXGetErrorDescription9W}
  101.  
  102. function DXGetErrorDescription9(hr: HRESULT): PChar;  stdcall; external dxerr9dll
  103.   name {$IFDEF UNICODE}'DXGetErrorDescription9W'{$ELSE}'DXGetErrorDescription9A'{$ENDIF};
  104. {$EXTERNALSYM DXGetErrorDescription9}
  105.  
  106.  
  107. //
  108. //  DXTrace
  109. //
  110. //  Desc:  Outputs a formatted error message to the debug stream
  111. //
  112. //  Args:  CHAR* strFile   The current file, typically passed in using the
  113. //                         __FILE__ macro.
  114. //         DWORD dwLine    The current line number, typically passed in using the
  115. //                         __LINE__ macro.
  116. //         HRESULT hr      An HRESULT that will be traced to the debug stream.
  117. //         CHAR* strMsg    A string that will be traced to the debug stream (may be NULL)
  118. //         BOOL bPopMsgBox If TRUE, then a message box will popup also containing the passed info.
  119. //
  120. //  Return: The hr that was passed in.
  121. //
  122.  
  123. function DXTraceA(strFile: PAnsiChar; dwLine: DWORD; hr: HRESULT; strMsg: PAnsiChar; bPopMsgBox: BOOL = FALSE): HRESULT; stdcall; external dxerr9dll;
  124. {$EXTERNALSYM DXTraceA}
  125. function DXTraceW(strFile: PWideChar; dwLine: DWORD; hr: HRESULT; strMsg: PWideChar; bPopMsgBox: BOOL = FALSE): HRESULT; stdcall; external dxerr9dll;
  126. {$EXTERNALSYM DXTraceW}
  127.  
  128. function DXTrace(strFile: PChar; dwLine: DWORD; hr: HRESULT; strMsg: PChar; bPopMsgBox: BOOL = FALSE): HRESULT; stdcall; external dxerr9dll
  129.   name {$IFDEF UNICODE}'DXTraceW'{$ELSE}'DXTraceA'{$ENDIF};
  130. {$EXTERNALSYM DXTrace}
  131.  
  132. //
  133. // Helper macros
  134. //
  135. (*
  136. #if defined(DEBUG) | defined(_DEBUG)
  137. #define DXTRACE_MSG(str)              DXTrace( __FILE__, (DWORD)__LINE__, 0, str, FALSE )
  138. #define DXTRACE_ERR(str,hr)           DXTrace( __FILE__, (DWORD)__LINE__, hr, str, FALSE )
  139. #define DXTRACE_ERR_MSGBOX(str,hr)    DXTrace( __FILE__, (DWORD)__LINE__, hr, str, TRUE )
  140. #else
  141. #define DXTRACE_MSG(str)              (0L)
  142. #define DXTRACE_ERR(str,hr)           (hr)
  143. #define DXTRACE_ERR_MSGBOX(str,hr)    (hr)
  144. #endif
  145. *)
  146.  
  147. implementation
  148.  
  149. end.
  150.  
  151.