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

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