dxerr8.pas 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. {******************************************************************************}
  2. {* *}
  3. {* Copyright (C) Microsoft Corporation. All Rights Reserved. *}
  4. {* *}
  5. {* File: dxerr8.h *}
  6. {* *}
  7. {* Content: DirectX Error Library Include File *}
  8. {* *}
  9. {* DirectX 8.x 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 DXErr8;
  44. interface
  45. {$HPPEMIT '#include "dxerr8.h"'}
  46. uses
  47. Windows;
  48. (*==========================================================================;
  49. *
  50. *
  51. * File: dxerr8.h
  52. * Content: DirectX Error Library Include File
  53. *
  54. ****************************************************************************)
  55. //
  56. // DXGetErrorString8
  57. //
  58. // Desc: Converts an DirectX HRESULT to a string
  59. //
  60. // Args: HRESULT hr Can be any error code from
  61. // DPLAY D3D8 D3DX8 DMUSIC DSOUND
  62. //
  63. // Return: Converted string
  64. //
  65. const
  66. //////////// DLL export definitions ///////////////////////////////////////
  67. dxerr8dll = 'dxerr81ab.dll';
  68. {$EXTERNALSYM dxerr8dll}
  69. function DXGetErrorString8A(hr: HRESULT): PAnsiChar; stdcall; external dxerr8dll;
  70. {$EXTERNALSYM DXGetErrorString8A}
  71. function DXGetErrorString8W(hr: HRESULT): PWideChar; stdcall; external dxerr8dll;
  72. {$EXTERNALSYM DXGetErrorString8W}
  73. function DXGetErrorString8(hr: HRESULT): PChar; stdcall; external dxerr8dll
  74. name {$IFDEF UNICODE}'DXGetErrorString8W'{$ELSE}'DXGetErrorString8A'{$ENDIF};
  75. {$EXTERNALSYM DXGetErrorString8}
  76. //
  77. // DXTrace
  78. //
  79. // Desc: Outputs a formatted error message to the debug stream
  80. //
  81. // Args: CHAR* strFile The current file, typically passed in using the
  82. // __FILE__ macro.
  83. // DWORD dwLine The current line number, typically passed in using the
  84. // __LINE__ macro.
  85. // HRESULT hr An HRESULT that will be traced to the debug stream.
  86. // CHAR* strMsg A string that will be traced to the debug stream (may be NULL)
  87. // BOOL bPopMsgBox If TRUE, then a message box will popup also containing the passed info.
  88. //
  89. // Return: The hr that was passed in.
  90. //
  91. function DXTraceA(strFile: PAnsiChar; dwLine: DWORD; hr: HRESULT; strMsg: PAnsiChar; bPopMsgBox: BOOL = FALSE): HRESULT; stdcall; external dxerr8dll;
  92. {$EXTERNALSYM DXTraceA}
  93. function DXTraceW(strFile: PWideChar; dwLine: DWORD; hr: HRESULT; strMsg: PWideChar; bPopMsgBox: BOOL = FALSE): HRESULT; stdcall; external dxerr8dll;
  94. {$EXTERNALSYM DXTraceW}
  95. function DXTrace(strFile: PChar; dwLine: DWORD; hr: HRESULT; strMsg: PChar; bPopMsgBox: BOOL = FALSE): HRESULT; stdcall; external dxerr8dll
  96. name {$IFDEF UNICODE}'DXTraceW'{$ELSE}'DXTraceA'{$ENDIF};
  97. {$EXTERNALSYM DXTrace}
  98. //
  99. // Helper macros
  100. //
  101. (*
  102. #if defined(DEBUG) | defined(_DEBUG)
  103. #define DXTRACE_MSG(str) DXTrace( __FILE__, (DWORD)__LINE__, 0, str, FALSE )
  104. #define DXTRACE_ERR(str,hr) DXTrace( __FILE__, (DWORD)__LINE__, hr, str, TRUE )
  105. #define DXTRACE_ERR_NOMSGBOX(str,hr) DXTrace( __FILE__, (DWORD)__LINE__, hr, str, FALSE )
  106. #else
  107. #define DXTRACE_MSG(str) (0L)
  108. #define DXTRACE_ERR(str,hr) (hr)
  109. #define DXTRACE_ERR_NOMSGBOX(str,hr) (hr)
  110. #endif
  111. *)
  112. implementation
  113. end.