dxerr9.pas 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  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. unit dxerr9;
  44. interface
  45. {$HPPEMIT '#include "dxerr9.h"'}
  46. uses
  47. Windows;
  48. (*==========================================================================;
  49. *
  50. *
  51. * File: dxerr9.h
  52. * Content: DirectX Error Library Include File
  53. *
  54. ****************************************************************************)
  55. const
  56. //////////// DLL export definitions ///////////////////////////////////////
  57. dxerr9dll = 'dxerr9ab.dll';
  58. {$EXTERNALSYM dxerr9dll}
  59. //
  60. // DXGetErrorString9
  61. //
  62. // Desc: Converts a DirectX 9 or earlier HRESULT to a string
  63. //
  64. // Args: HRESULT hr Can be any error code from
  65. // D3D9 D3DX9 D3D8 D3DX8 DDRAW DPLAY8 DMUSIC DSOUND DINPUT DSHOW
  66. //
  67. // Return: Converted string
  68. //
  69. function DXGetErrorString9A(hr: HRESULT): PAnsiChar; stdcall; external dxerr9dll;
  70. {$EXTERNALSYM DXGetErrorString9A}
  71. function DXGetErrorString9W(hr: HRESULT): PWideChar; stdcall; external dxerr9dll;
  72. {$EXTERNALSYM DXGetErrorString9W}
  73. function DXGetErrorString9(hr: HRESULT): PChar; stdcall; external dxerr9dll
  74. name {$IFDEF UNICODE}'DXGetErrorString9W'{$ELSE}'DXGetErrorString9A'{$ENDIF};
  75. {$EXTERNALSYM DXGetErrorString9}
  76. //
  77. // DXGetErrorDescription9
  78. //
  79. // Desc: Returns a string description of a DirectX 9 or earlier HRESULT
  80. //
  81. // Args: HRESULT hr Can be any error code from
  82. // D3D9 D3DX9 D3D8 D3DX8 DDRAW DPLAY8 DMUSIC DSOUND DINPUT DSHOW
  83. //
  84. // Return: String description
  85. //
  86. function DXGetErrorDescription9A(hr: HRESULT): PAnsiChar; stdcall; external dxerr9dll;
  87. {$EXTERNALSYM DXGetErrorDescription9A}
  88. function DXGetErrorDescription9W(hr: HRESULT): PWideChar; stdcall; external dxerr9dll;
  89. {$EXTERNALSYM DXGetErrorDescription9W}
  90. function DXGetErrorDescription9(hr: HRESULT): PChar; stdcall; external dxerr9dll
  91. name {$IFDEF UNICODE}'DXGetErrorDescription9W'{$ELSE}'DXGetErrorDescription9A'{$ENDIF};
  92. {$EXTERNALSYM DXGetErrorDescription9}
  93. //
  94. // DXTrace
  95. //
  96. // Desc: Outputs a formatted error message to the debug stream
  97. //
  98. // Args: CHAR* strFile The current file, typically passed in using the
  99. // __FILE__ macro.
  100. // DWORD dwLine The current line number, typically passed in using the
  101. // __LINE__ macro.
  102. // HRESULT hr An HRESULT that will be traced to the debug stream.
  103. // CHAR* strMsg A string that will be traced to the debug stream (may be NULL)
  104. // BOOL bPopMsgBox If TRUE, then a message box will popup also containing the passed info.
  105. //
  106. // Return: The hr that was passed in.
  107. //
  108. function DXTraceA(strFile: PAnsiChar; dwLine: DWORD; hr: HRESULT; strMsg: PAnsiChar; bPopMsgBox: BOOL = FALSE): HRESULT; stdcall; external dxerr9dll;
  109. {$EXTERNALSYM DXTraceA}
  110. function DXTraceW(strFile: PWideChar; dwLine: DWORD; hr: HRESULT; strMsg: PWideChar; bPopMsgBox: BOOL = FALSE): HRESULT; stdcall; external dxerr9dll;
  111. {$EXTERNALSYM DXTraceW}
  112. function DXTrace(strFile: PChar; dwLine: DWORD; hr: HRESULT; strMsg: PChar; bPopMsgBox: BOOL = FALSE): HRESULT; stdcall; external dxerr9dll
  113. name {$IFDEF UNICODE}'DXTraceW'{$ELSE}'DXTraceA'{$ENDIF};
  114. {$EXTERNALSYM DXTrace}
  115. //
  116. // Helper macros
  117. //
  118. (*
  119. #if defined(DEBUG) | defined(_DEBUG)
  120. #define DXTRACE_MSG(str) DXTrace( __FILE__, (DWORD)__LINE__, 0, str, FALSE )
  121. #define DXTRACE_ERR(str,hr) DXTrace( __FILE__, (DWORD)__LINE__, hr, str, FALSE )
  122. #define DXTRACE_ERR_MSGBOX(str,hr) DXTrace( __FILE__, (DWORD)__LINE__, hr, str, TRUE )
  123. #else
  124. #define DXTRACE_MSG(str) (0L)
  125. #define DXTRACE_ERR(str,hr) (hr)
  126. #define DXTRACE_ERR_MSGBOX(str,hr) (hr)
  127. #endif
  128. *)
  129. implementation
  130. end.