DirectInput.pas
上传用户:hylc_2004
上传日期:2014-01-23
资源大小:46800k
文件大小:319k
源码类别:

Delphi控件源码

开发平台:

Delphi

  1. {******************************************************************************}
  2. {*                                                                            *}
  3. {*  Copyright (C) Microsoft Corporation.  All Rights Reserved.                *}
  4. {*                                                                            *}
  5. {*  Files:      dinput.h                                                      *}
  6. {*  Content:    DirectInput include file                                      *}
  7. {*                                                                            *}
  8. {*  DirectX 9.0 Delphi adaptation by Alexey Barkovoy                          *}
  9. {*  E-Mail: clootie@reactor.ru                                                *}
  10. {*                                                                            *}
  11. {*  Modified: 26-Jan-2003                                                     *}
  12. {*                                                                            *}
  13. {*  Compatible with :                                                         *}
  14. {*    DirectX 7.0 Object Pascal adaptation by                                 *}
  15. {*      Erik Unger, e-Mail: DelphiDirectX@next-reality.com                    *}
  16. {*                                                                            *}
  17. {*  Latest version can be downloaded from:                                    *}
  18. {*     http://clootie.narod.ru/delphi                                         *}
  19. {*                                                                            *}
  20. {******************************************************************************}
  21. {                                                                              }
  22. { Obtained through: Joint Endeavour of Delphi Innovators (Project JEDI)        }
  23. {                                                                              }
  24. { The contents of this file are used with permission, subject to the Mozilla   }
  25. { Public License Version 1.1 (the "License"); you may not use this file except }
  26. { in compliance with the License. You may obtain a copy of the License at      }
  27. { http://www.mozilla.org/MPL/MPL-1.1.html                                      }
  28. {                                                                              }
  29. { Software distributed under the License is distributed on an "AS IS" basis,   }
  30. { WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for }
  31. { the specific language governing rights and limitations under the License.    }
  32. {                                                                              }
  33. { Alternatively, the contents of this file may be used under the terms of the  }
  34. { GNU Lesser General Public License (the  "LGPL License"), in which case the   }
  35. { provisions of the LGPL License are applicable instead of those above.        }
  36. { If you wish to allow use of your version of this file only under the terms   }
  37. { of the LGPL License and not to allow others to use your version of this file }
  38. { under the MPL, indicate your decision by deleting  the provisions above and  }
  39. { replace  them with the notice and other provisions required by the LGPL      }
  40. { License.  If you do not delete the provisions above, a recipient may use     }
  41. { your version of this file under either the MPL or the LGPL License.          }
  42. {                                                                              }
  43. { For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html }
  44. {                                                                              }
  45. {******************************************************************************}
  46. // Original source contained in "DirectInput.par"
  47. ///////////////////////////////////////////////////////////////////////////////
  48. // Notes:
  49. //----------------------------------------------------------------------------
  50. // Possible input defines for this file, mapped to original C values:
  51. //   DIRECTINPUT_VERSION_8 : DIRECTINPUT_VERSION = 0x0800,
  52. //   DIRECTINPUT_VERSION_7 : DIRECTINPUT_VERSION = 0x0700,
  53. //   DIRECTINPUT_VERSION_5b : DIRECTINPUT_VERSION = 0x05b2,
  54. //     - in this translation we don't support DirectInput 5.0a (0x050a) version
  55. //       - just straight 5.0b (0x05b2) one.
  56. //   DIRECTINPUT_VERSION_5 : DIRECTINPUT_VERSION = 0x0500,
  57. //   DIRECTINPUT_VERSION_3 : DIRECTINPUT_VERSION = 0x0300,
  58. //
  59. // By default DIRECTINPUT_VERSION_8 (DIRECTINPUT_VERSION = 0x0800) is assumed
  60. //
  61. // Also you can use generic DIRECTXx defines, so:
  62. //   DIRECTX9 equal to DIRECTINPUT_VERSION_8;
  63. //   DIRECTX8 equal to DIRECTINPUT_VERSION_8;
  64. //   DIRECTX7 equal to DIRECTINPUT_VERSION_7;
  65. //   DIRECTX6 equal to DIRECTINPUT_VERSION_5;
  66. //   DIRECTX5 equal to DIRECTINPUT_VERSION_5;
  67. //   DIRECTX3 equal to DIRECTINPUT_VERSION_3
  68. ///////////////////////////////////////////////////////////////////////////////
  69. unit DirectInput;
  70. interface
  71. uses
  72.   Windows, MMSystem, DXTypes;
  73. {$I DirectX.inc}
  74. ////////////////////////////////////////////////////////////////////////
  75. // Global level dynamic loading support
  76. {$IFDEF DYNAMIC_LINK_ALL}
  77.   {$DEFINE DIRECTINPUT_DYNAMIC_LINK}
  78. {$ENDIF}
  79. {$IFDEF DYNAMIC_LINK_EXPLICIT_ALL}
  80.   {$DEFINE DIRECTINPUT_DYNAMIC_LINK_EXPLICIT}
  81. {$ENDIF}
  82. // Remove "dots" below to force some kind of dynamic linking
  83. {.$DEFINE DIRECTINPUT_DYNAMIC_LINK}
  84. {.$DEFINE DIRECTINPUT_DYNAMIC_LINK_EXPLICIT}
  85. ////////////////////////////////////////////////////////////////////////
  86. // Assume for what DirectInput version we will compile headers
  87. {$IFDEF DIRECTX9}
  88.   {$DEFINE DIRECTINPUT_VERSION_8}
  89. {$ENDIF}
  90. {$IFDEF DIRECTX8}
  91.   {$DEFINE DIRECTINPUT_VERSION_8}
  92. {$ENDIF}
  93. {$IFDEF DIRECTX7}
  94.   {$DEFINE DIRECTINPUT_VERSION_7}
  95. {$ENDIF}
  96. {$IFDEF DIRECTX6}
  97.   {$DEFINE DIRECTINPUT_VERSION_5}
  98. {$ENDIF}
  99. {$IFDEF DIRECTX5}
  100.   {$DEFINE DIRECTINPUT_VERSION_5}
  101. {$ENDIF}
  102. {$IFDEF DIRECTX3}
  103.   {$DEFINE DIRECTINPUT_VERSION_3}
  104. {$ENDIF}
  105. {$IFNDEF DIRECTINPUT_VERSION_8}
  106.   {$IFNDEF DIRECTINPUT_VERSION_7}
  107.     {$IFNDEF DIRECTINPUT_VERSION_5b}
  108.       {$IFNDEF DIRECTINPUT_VERSION_5}
  109.         {$IFNDEF DIRECTINPUT_VERSION_3}
  110. // Compiling for DirectInput8 by default
  111. {$DEFINE DIRECTINPUT_VERSION_8}
  112.         {$ENDIF}
  113.       {$ENDIF}
  114.     {$ENDIF}
  115.   {$ENDIF}
  116. {$ENDIF}
  117. ////////////////////////////////////////////////////////////////////////
  118. // Define DirectInputVerrsion constant
  119. const
  120. {$IFDEF DIRECTINPUT_VERSION_8}
  121.   DIRECTINPUT_VERSION = $0800;
  122. {$ELSE}{$IFDEF DIRECTINPUT_VERSION_7}
  123.   DIRECTINPUT_VERSION = $0700;
  124. {$ELSE}{$IFDEF DIRECTINPUT_VERSION_5b}
  125.   DIRECTINPUT_VERSION = $05b2;
  126. {$ELSE}{$IFDEF DIRECTINPUT_VERSION_5}
  127.   DIRECTINPUT_VERSION = $0500;
  128. {$ELSE}{$IFDEF DIRECTINPUT_VERSION_3}
  129.   DIRECTINPUT_VERSION = $0300;
  130. {$ENDIF}{$ENDIF}{$ENDIF}{$ENDIF}{$ENDIF}
  131.   {$EXTERNALSYM DIRECTINPUT_VERSION}
  132. ////////////////////////////////////////////////////////////////////////
  133. // Emit conditionals to C++Builder compiler
  134. {$IFDEF DIRECTINPUT_VERSION_3}
  135.   {$HPPEMIT '#define DIRECTINPUT_VERSION         0x0300'}
  136. {$ENDIF}
  137. {$IFDEF DIRECTINPUT_VERSION_5}
  138.   {$HPPEMIT '#define DIRECTINPUT_VERSION         0x0500'}
  139. {$ENDIF}
  140. {$IFDEF DIRECTINPUT_VERSION_5b}
  141.   {$HPPEMIT '#define DIRECTINPUT_VERSION         0x05b2'}
  142. {$ENDIF}
  143. {$IFDEF DIRECTINPUT_VERSION_7}
  144.   {$HPPEMIT '#define DIRECTINPUT_VERSION         0x0700'}
  145. {$ENDIF}
  146. {$IFDEF DIRECTINPUT_VERSION_8}
  147.   {$HPPEMIT '#define DIRECTINPUT_VERSION         0x0800'}
  148. {$ENDIF}
  149. (*$NOINCLUDE DXTypes*)
  150. (*$HPPEMIT '#include "dinput.h"' *)
  151. (*$HPPEMIT '' *)
  152. ////////////////////////////////////////////////////////////////////////
  153. // Define symbols for '<=' comparision
  154. {$IFDEF DIRECTINPUT_VERSION_8}
  155.   {$DEFINE DIRECTINPUT_VERSION_7}
  156. {$ENDIF}
  157. {$IFDEF DIRECTINPUT_VERSION_7}
  158.   {$DEFINE DIRECTINPUT_VERSION_5b}
  159. {$ENDIF}
  160. {$IFDEF DIRECTINPUT_VERSION_5b}
  161.   {$DEFINE DIRECTINPUT_VERSION_5}
  162. {$ENDIF}
  163. {$IFDEF DIRECTINPUT_VERSION_5}
  164.   {$DEFINE DIRECTINPUT_VERSION_3}
  165. {$ENDIF}
  166. (****************************************************************************
  167.  *
  168.  *  Copyright (C) 1996-2000 Microsoft Corporation.  All Rights Reserved.
  169.  *
  170.  *  File:       dinput.h
  171.  *  Content:    DirectInput include file
  172.  *
  173.  ****************************************************************************)
  174. {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirectInputEffect);'}
  175. {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirectInputDeviceA);'}
  176. {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirectInputDeviceW);'}
  177. {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirectInputA);'}
  178. {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirectInputW);'}
  179. {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirectInput2A);'}
  180. {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirectInput2W);'}
  181. {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirectInput7A);'}
  182. {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirectInput7W);'}
  183. {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirectInput8A);'}
  184. {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirectInput8W);'}
  185. {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirectInputDeviceA);'}
  186. {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirectInputDeviceW);'}
  187. {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirectInputDevice2A);'}
  188. {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirectInputDevice2W);'}
  189. {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirectInputDevice7A);'}
  190. {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirectInputDevice7W);'}
  191. {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirectInputDevice8A);'}
  192. {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IDirectInputDevice8W);'}
  193. {$HPPEMIT '#ifdef UNICODE'}
  194. {$HPPEMIT 'typedef _di_IDirectInputW _di_IDirectInput;'}
  195. {$HPPEMIT 'typedef _di_IDirectInput2W _di_IDirectInput2;'}
  196. {$HPPEMIT 'typedef _di_IDirectInput7W _di_IDirectInput7;'}
  197. {$HPPEMIT 'typedef _di_IDirectInput8W _di_IDirectInput8;'}
  198. {$HPPEMIT 'typedef _di_IDirectInputDeviceW _di_IDirectInputDevice;'}
  199. {$HPPEMIT 'typedef _di_IDirectInputDevice2W _di_IDirectInputDevice2;'}
  200. {$HPPEMIT 'typedef _di_IDirectInputDevice7W _di_IDirectInputDevice7;'}
  201. {$HPPEMIT 'typedef _di_IDirectInputDevice8W _di_IDirectInputDevice8;'}
  202. {$HPPEMIT '#else'}
  203. {$HPPEMIT 'typedef _di_IDirectInputA _di_IDirectInput;'}
  204. {$HPPEMIT 'typedef _di_IDirectInput2A _di_IDirectInput2;'}
  205. {$HPPEMIT 'typedef _di_IDirectInput7A _di_IDirectInput7;'}
  206. {$HPPEMIT 'typedef _di_IDirectInput8A _di_IDirectInput8;'}
  207. {$HPPEMIT 'typedef _di_IDirectInputDeviceA _di_IDirectInputDevice;'}
  208. {$HPPEMIT 'typedef _di_IDirectInputDevice2A _di_IDirectInputDevice2;'}
  209. {$HPPEMIT 'typedef _di_IDirectInputDevice7A _di_IDirectInputDevice7;'}
  210. {$HPPEMIT 'typedef _di_IDirectInputDevice8A _di_IDirectInputDevice8;'}
  211. {$HPPEMIT '#endif'}
  212. (****************************************************************************
  213.  *
  214.  *      Class IDs
  215.  *
  216.  ****************************************************************************)
  217. const
  218.   CLSID_DirectInput        : TGUID = '{25E609E0-B259-11CF-BFC7-444553540000}';
  219.   {$EXTERNALSYM CLSID_DirectInput}
  220.   CLSID_DirectInputDevice  : TGUID = '{25E609E1-B259-11CF-BFC7-444553540000}';
  221.   {$EXTERNALSYM CLSID_DirectInputDevice}
  222.   CLSID_DirectInput8       : TGUID = '{25E609E4-B259-11CF-BFC7-444553540000}';
  223.   {$EXTERNALSYM CLSID_DirectInput8}
  224.   CLSID_DirectInputDevice8 : TGUID = '{25E609E5-B259-11CF-BFC7-444553540000}';
  225.   {$EXTERNALSYM CLSID_DirectInputDevice8}
  226. (****************************************************************************
  227.  *
  228.  *      Interfaces
  229.  *
  230.  ****************************************************************************)
  231. const
  232.   IID_IDirectInputA        : TGUID = '{89521360-AA8A-11CF-BFC7-444553540000}';
  233.   {$EXTERNALSYM IID_IDirectInputA}
  234.   IID_IDirectInputW        : TGUID = '{89521361-AA8A-11CF-BFC7-444553540000}';
  235.   {$EXTERNALSYM IID_IDirectInputW}
  236.   IID_IDirectInput2A       : TGUID = '{5944E662-AA8A-11CF-BFC7-444553540000}';
  237.   {$EXTERNALSYM IID_IDirectInput2A}
  238.   IID_IDirectInput2W       : TGUID = '{5944E663-AA8A-11CF-BFC7-444553540000}';
  239.   {$EXTERNALSYM IID_IDirectInput2W}
  240.   IID_IDirectInput7A       : TGUID = '{9A4CB684-236D-11D3-8E9D-00C04F6844AE}';
  241.   {$EXTERNALSYM IID_IDirectInput7A}
  242.   IID_IDirectInput7W       : TGUID = '{9A4CB685-236D-11D3-8E9D-00C04F6844AE}';
  243.   {$EXTERNALSYM IID_IDirectInput7W}
  244.   IID_IDirectInput8A       : TGUID = '{BF798030-483A-4DA2-AA99-5D64ED369700}';
  245.   {$EXTERNALSYM IID_IDirectInput8A}
  246.   IID_IDirectInput8W       : TGUID = '{BF798031-483A-4DA2-AA99-5D64ED369700}';
  247.   {$EXTERNALSYM IID_IDirectInput8W}
  248.   IID_IDirectInputDeviceA  : TGUID = '{5944E680-C92E-11CF-BFC7-444553540000}';
  249.   {$EXTERNALSYM IID_IDirectInputDeviceA}
  250.   IID_IDirectInputDeviceW  : TGUID = '{5944E681-C92E-11CF-BFC7-444553540000}';
  251.   {$EXTERNALSYM IID_IDirectInputDeviceW}
  252.   IID_IDirectInputDevice2A : TGUID = '{5944E682-C92E-11CF-BFC7-444553540000}';
  253.   {$EXTERNALSYM IID_IDirectInputDevice2A}
  254.   IID_IDirectInputDevice2W : TGUID = '{5944E683-C92E-11CF-BFC7-444553540000}';
  255.   {$EXTERNALSYM IID_IDirectInputDevice2W}
  256.   IID_IDirectInputDevice7A : TGUID = '{57D7C6BC-2356-11D3-8E9D-00C04F6844AE}';
  257.   {$EXTERNALSYM IID_IDirectInputDevice7A}
  258.   IID_IDirectInputDevice7W : TGUID = '{57D7C6BD-2356-11D3-8E9D-00C04F6844AE}';
  259.   {$EXTERNALSYM IID_IDirectInputDevice7W}
  260.   IID_IDirectInputDevice8A : TGUID = '{54D41080-DC15-4833-A41B-748F73A38179}';
  261.   {$EXTERNALSYM IID_IDirectInputDevice8A}
  262.   IID_IDirectInputDevice8W : TGUID = '{54D41081-DC15-4833-A41B-748F73A38179}';
  263.   {$EXTERNALSYM IID_IDirectInputDevice8W}
  264.   IID_IDirectInputEffect   : TGUID = '{E7E1F7C0-88D2-11D0-9AD0-00A0C9A06E35}';
  265.   {$EXTERNALSYM IID_IDirectInputEffect}
  266.   // String constants for Interface IDs
  267.   SID_IDirectInputA        = '{89521360-AA8A-11CF-BFC7-444553540000}';
  268.   SID_IDirectInputW        = '{89521361-AA8A-11CF-BFC7-444553540000}';
  269.   SID_IDirectInput2A       = '{5944E662-AA8A-11CF-BFC7-444553540000}';
  270.   SID_IDirectInput2W       = '{5944E663-AA8A-11CF-BFC7-444553540000}';
  271.   SID_IDirectInput7A       = '{9A4CB684-236D-11D3-8E9D-00C04F6844AE}';
  272.   SID_IDirectInput7W       = '{9A4CB685-236D-11D3-8E9D-00C04F6844AE}';
  273.   SID_IDirectInput8A       = '{BF798030-483A-4DA2-AA99-5D64ED369700}';
  274.   SID_IDirectInput8W       = '{BF798031-483A-4DA2-AA99-5D64ED369700}';
  275.   SID_IDirectInputDeviceA  = '{5944E680-C92E-11CF-BFC7-444553540000}';
  276.   SID_IDirectInputDeviceW  = '{5944E681-C92E-11CF-BFC7-444553540000}';
  277.   SID_IDirectInputDevice2A = '{5944E682-C92E-11CF-BFC7-444553540000}';
  278.   SID_IDirectInputDevice2W = '{5944E683-C92E-11CF-BFC7-444553540000}';
  279.   SID_IDirectInputDevice7A = '{57D7C6BC-2356-11D3-8E9D-00C04F6844AE}';
  280.   SID_IDirectInputDevice7W = '{57D7C6BD-2356-11D3-8E9D-00C04F6844AE}';
  281.   SID_IDirectInputDevice8A = '{54D41080-DC15-4833-A41B-748F73A38179}';
  282.   SID_IDirectInputDevice8W = '{54D41081-DC15-4833-A41B-748F73A38179}';
  283.   SID_IDirectInputEffect   = '{E7E1F7C0-88D2-11D0-9AD0-00A0C9A06E35}';
  284.   
  285. (****************************************************************************
  286.  *
  287.  *      Predefined object types
  288.  *
  289.  ****************************************************************************)
  290. const
  291.   GUID_XAxis   : TGUID = '{A36D02E0-C9F3-11CF-BFC7-444553540000}';
  292.   {$EXTERNALSYM GUID_XAxis}
  293.   GUID_YAxis   : TGUID = '{A36D02E1-C9F3-11CF-BFC7-444553540000}';
  294.   {$EXTERNALSYM GUID_YAxis}
  295.   GUID_ZAxis   : TGUID = '{A36D02E2-C9F3-11CF-BFC7-444553540000}';
  296.   {$EXTERNALSYM GUID_ZAxis}
  297.   GUID_RxAxis  : TGUID = '{A36D02F4-C9F3-11CF-BFC7-444553540000}';
  298.   {$EXTERNALSYM GUID_RxAxis}
  299.   GUID_RyAxis  : TGUID = '{A36D02F5-C9F3-11CF-BFC7-444553540000}';
  300.   {$EXTERNALSYM GUID_RyAxis}
  301.   GUID_RzAxis  : TGUID = '{A36D02E3-C9F3-11CF-BFC7-444553540000}';
  302.   {$EXTERNALSYM GUID_RzAxis}
  303.   GUID_Slider  : TGUID = '{A36D02E4-C9F3-11CF-BFC7-444553540000}';
  304.   {$EXTERNALSYM GUID_Slider}
  305.   GUID_Button  : TGUID = '{A36D02F0-C9F3-11CF-BFC7-444553540000}';
  306.   {$EXTERNALSYM GUID_Button}
  307.   GUID_Key     : TGUID = '{55728220-D33C-11CF-BFC7-444553540000}';
  308.   {$EXTERNALSYM GUID_Key}
  309.   GUID_POV     : TGUID = '{A36D02F2-C9F3-11CF-BFC7-444553540000}';
  310.   {$EXTERNALSYM GUID_POV}
  311.   GUID_Unknown : TGUID = '{A36D02F3-C9F3-11CF-BFC7-444553540000}';
  312.   {$EXTERNALSYM GUID_Unknown}
  313. (****************************************************************************
  314.  *
  315.  *      Predefined product GUIDs
  316.  *
  317.  ****************************************************************************)
  318. const
  319.   GUID_SysMouse       : TGUID = '{6F1D2B60-D5A0-11CF-BFC7-444553540000}';
  320.   {$EXTERNALSYM GUID_SysMouse}
  321.   GUID_SysKeyboard    : TGUID = '{6F1D2B61-D5A0-11CF-BFC7-444553540000}';
  322.   {$EXTERNALSYM GUID_SysKeyboard}
  323.   GUID_Joystick       : TGUID = '{6F1D2B70-D5A0-11CF-BFC7-444553540000}';
  324.   {$EXTERNALSYM GUID_Joystick}
  325.   GUID_SysMouseEm     : TGUID = '{6F1D2B80-D5A0-11CF-BFC7-444553540000}';
  326.   {$EXTERNALSYM GUID_SysMouseEm}
  327.   GUID_SysMouseEm2    : TGUID = '{6F1D2B81-D5A0-11CF-BFC7-444553540000}';
  328.   {$EXTERNALSYM GUID_SysMouseEm2}
  329.   GUID_SysKeyboardEm  : TGUID = '{6F1D2B82-D5A0-11CF-BFC7-444553540000}';
  330.   {$EXTERNALSYM GUID_SysKeyboardEm}
  331.   GUID_SysKeyboardEm2 : TGUID = '{6F1D2B83-D5A0-11CF-BFC7-444553540000}';
  332.   {$EXTERNALSYM GUID_SysKeyboardEm2}
  333. (****************************************************************************
  334.  *
  335.  *      Predefined force feedback effects
  336.  *
  337.  ****************************************************************************)
  338. const
  339.   GUID_ConstantForce : TGUID = '{13541C20-8E33-11D0-9AD0-00A0C9A06E35}';
  340.   {$EXTERNALSYM GUID_ConstantForce}
  341.   GUID_RampForce     : TGUID = '{13541C21-8E33-11D0-9AD0-00A0C9A06E35}';
  342.   {$EXTERNALSYM GUID_RampForce}
  343.   GUID_Square        : TGUID = '{13541C22-8E33-11D0-9AD0-00A0C9A06E35}';
  344.   {$EXTERNALSYM GUID_Square}
  345.   GUID_Sine          : TGUID = '{13541C23-8E33-11D0-9AD0-00A0C9A06E35}';
  346.   {$EXTERNALSYM GUID_Sine}
  347.   GUID_Triangle      : TGUID = '{13541C24-8E33-11D0-9AD0-00A0C9A06E35}';
  348.   {$EXTERNALSYM GUID_Triangle}
  349.   GUID_SawtoothUp    : TGUID = '{13541C25-8E33-11D0-9AD0-00A0C9A06E35}';
  350.   {$EXTERNALSYM GUID_SawtoothUp}
  351.   GUID_SawtoothDown  : TGUID = '{13541C26-8E33-11D0-9AD0-00A0C9A06E35}';
  352.   {$EXTERNALSYM GUID_SawtoothDown}
  353.   GUID_Spring        : TGUID = '{13541C27-8E33-11D0-9AD0-00A0C9A06E35}';
  354.   {$EXTERNALSYM GUID_Spring}
  355.   GUID_Damper        : TGUID = '{13541C28-8E33-11D0-9AD0-00A0C9A06E35}';
  356.   {$EXTERNALSYM GUID_Damper}
  357.   GUID_Inertia       : TGUID = '{13541C29-8E33-11D0-9AD0-00A0C9A06E35}';
  358.   {$EXTERNALSYM GUID_Inertia}
  359.   GUID_Friction      : TGUID = '{13541C2A-8E33-11D0-9AD0-00A0C9A06E35}';
  360.   {$EXTERNALSYM GUID_Friction}
  361.   GUID_CustomForce   : TGUID = '{13541C2B-8E33-11D0-9AD0-00A0C9A06E35}';
  362.   {$EXTERNALSYM GUID_CustomForce}
  363.   
  364. (****************************************************************************
  365.  *
  366.  *      Interfaces and Structures...
  367.  *
  368.  ****************************************************************************)
  369. {$IFDEF DIRECTINPUT_VERSION_5}
  370. (****************************************************************************
  371.  *
  372.  *      IDirectInputEffect
  373.  *
  374.  ****************************************************************************)
  375. const
  376.   DIEFT_ALL                   = $00000000;
  377.   {$EXTERNALSYM DIEFT_ALL}
  378.   DIEFT_CONSTANTFORCE         = $00000001;
  379.   {$EXTERNALSYM DIEFT_CONSTANTFORCE}
  380.   DIEFT_RAMPFORCE             = $00000002;
  381.   {$EXTERNALSYM DIEFT_RAMPFORCE}
  382.   DIEFT_PERIODIC              = $00000003;
  383.   {$EXTERNALSYM DIEFT_PERIODIC}
  384.   DIEFT_CONDITION             = $00000004;
  385.   {$EXTERNALSYM DIEFT_CONDITION}
  386.   DIEFT_CUSTOMFORCE           = $00000005;
  387.   {$EXTERNALSYM DIEFT_CUSTOMFORCE}
  388.   DIEFT_HARDWARE              = $000000FF;
  389.   {$EXTERNALSYM DIEFT_HARDWARE}
  390.   DIEFT_FFATTACK              = $00000200;
  391.   {$EXTERNALSYM DIEFT_FFATTACK}
  392.   DIEFT_FFFADE                = $00000400;
  393.   {$EXTERNALSYM DIEFT_FFFADE}
  394.   DIEFT_SATURATION            = $00000800;
  395.   {$EXTERNALSYM DIEFT_SATURATION}
  396.   DIEFT_POSNEGCOEFFICIENTS    = $00001000;
  397.   {$EXTERNALSYM DIEFT_POSNEGCOEFFICIENTS}
  398.   DIEFT_POSNEGSATURATION      = $00002000;
  399.   {$EXTERNALSYM DIEFT_POSNEGSATURATION}
  400.   DIEFT_DEADBAND              = $00004000;
  401.   {$EXTERNALSYM DIEFT_DEADBAND}
  402.   DIEFT_STARTDELAY            = $00008000;
  403.   {$EXTERNALSYM DIEFT_STARTDELAY}
  404. //#define DIEFT_GETTYPE(n)            LOBYTE(n)
  405. function DIEFT_GETTYPE(n: Cardinal): Byte;
  406. {$EXTERNALSYM DIEFT_GETTYPE}
  407. const
  408.   DI_DEGREES                  = 100;
  409.   {$EXTERNALSYM DI_DEGREES}
  410.   DI_FFNOMINALMAX             = 10000;
  411.   {$EXTERNALSYM DI_FFNOMINALMAX}
  412.   DI_SECONDS                  = 1000000;
  413.   {$EXTERNALSYM DI_SECONDS}
  414. type
  415.   PDIConstantForce = ^TDIConstantForce;
  416.   DICONSTANTFORCE = packed record
  417.     lMagnitude: Longint;
  418.   end;
  419.   {$EXTERNALSYM DICONSTANTFORCE}
  420.   TDIConstantForce = DICONSTANTFORCE;
  421.   PDIRampForce = ^TDIRampForce;
  422.   DIRAMPFORCE = packed record
  423.     lStart: Longint;
  424.     lEnd: Longint;
  425.   end;
  426.   {$EXTERNALSYM DIRAMPFORCE}
  427.   TDIRampForce = DIRAMPFORCE;
  428.   PDIPeriodic = ^TDIPeriodic;
  429.   DIPERIODIC = packed record
  430.     dwMagnitude: DWORD;
  431.     lOffset: Longint;
  432.     dwPhase: DWORD;
  433.     dwPeriod: DWORD;
  434.   end;
  435.   {$EXTERNALSYM DIPERIODIC}
  436.   TDIPeriodic = DIPERIODIC;
  437.   PDICondition = ^TDICondition;
  438.   DICONDITION = packed record
  439.     lOffset: Longint;
  440.     lPositiveCoefficient: Longint;
  441.     lNegativeCoefficient: Longint;
  442.     dwPositiveSaturation: DWORD;
  443.     dwNegativeSaturation: DWORD;
  444.     lDeadBand: Longint;
  445.   end;
  446.   {$EXTERNALSYM DICONDITION}
  447.   TDICondition = DICONDITION;
  448.   PDICustomForce = ^TDICustomForce;
  449.   DICUSTOMFORCE = packed record
  450.     cChannels: DWORD;
  451.     dwSamplePeriod: DWORD;
  452.     cSamples: DWORD;
  453.     rglForceData: PLongint;
  454.   end;
  455.   {$EXTERNALSYM DICUSTOMFORCE}
  456.   TDICustomForce = DICUSTOMFORCE;
  457.   PDIEnvelope = ^TDIEnvelope;
  458.   DIENVELOPE = packed record
  459.     dwSize: DWORD;                   (* sizeof(DIENVELOPE)   *)
  460.     dwAttackLevel: DWORD;
  461.     dwAttackTime: DWORD;             (* Microseconds         *)
  462.     dwFadeLevel: DWORD;
  463.     dwFadeTime: DWORD;               (* Microseconds         *)
  464.   end;
  465.   {$EXTERNALSYM DIENVELOPE}
  466.   TDIEnvelope = DIENVELOPE;
  467. (* This structure is defined for DirectX 5.0 compatibility *)
  468.   PDIEffectDX5 = ^TDIEffectDX5;
  469.   DIEFFECT_DX5 = packed record
  470.     dwSize: DWORD;                   (* sizeof(DIEFFECT_DX5) *)
  471.     dwFlags: DWORD;                  (* DIEFF_*              *)
  472.     dwDuration: DWORD;               (* Microseconds         *)
  473.     dwSamplePeriod: DWORD;           (* Microseconds         *)
  474.     dwGain: DWORD;
  475.     dwTriggerButton: DWORD;          (* or DIEB_NOTRIGGER    *)
  476.     dwTriggerRepeatInterval: DWORD;  (* Microseconds         *)
  477.     cAxes: DWORD;                    (* Number of axes       *)
  478.     rgdwAxes: PDWORD;                (* Array of axes        *)
  479.     rglDirection: PLongint;          (* Array of directions  *)
  480.     lpEnvelope: PDIEnvelope;         (* Optional             *)
  481.     cbTypeSpecificParams: DWORD;     (* Size of params       *)
  482.     lpvTypeSpecificParams: Pointer;  (* Pointer to params    *)
  483.   end;
  484.   {$EXTERNALSYM DIEFFECT_DX5}
  485.   TDIEffectDX5 = DIEFFECT_DX5;
  486.   PDIEffect = ^TDIEffect;
  487.   DIEFFECT = packed record
  488.     dwSize: DWORD;                   (* sizeof(DIEFFECT)     *)
  489.     dwFlags: DWORD;                  (* DIEFF_*              *)
  490.     dwDuration: DWORD;               (* Microseconds         *)
  491.     dwSamplePeriod: DWORD;           (* Microseconds         *)
  492.     dwGain: DWORD;
  493.     dwTriggerButton: DWORD;          (* or DIEB_NOTRIGGER    *)
  494.     dwTriggerRepeatInterval: DWORD;  (* Microseconds         *)
  495.     cAxes: DWORD;                    (* Number of axes       *)
  496.     rgdwAxes: PDWORD;                (* Array of axes        *)
  497.     rglDirection: PLongint;          (* Array of directions  *)
  498.     lpEnvelope: PDIEnvelope;         (* Optional             *)
  499.     cbTypeSpecificParams: DWORD;     (* Size of params       *)
  500.     lpvTypeSpecificParams: Pointer;  (* Pointer to params    *)
  501. {$IFDEF DIRECTINPUT_VERSION_6}
  502.     dwStartDelay:  DWORD;            (* Microseconds         *)
  503. {$ENDIF} (* DIRECTINPUT_VERSION >= 0x0600 *)
  504.   end;
  505.   {$EXTERNALSYM DIEFFECT}
  506.   TDIEffect = DIEFFECT;
  507.   DIEFFECT_DX6 = DIEFFECT;
  508.   {$EXTERNALSYM DIEFFECT_DX6}
  509.   TDIEffectDX6 = DIEFFECT_DX6;
  510.   PDIEffectDX6 = ^TDIEffectDX6;
  511. {$IFDEF DIRECTINPUT_VERSION_7}
  512.   PDIFileEffect = ^TDIFileEffect;
  513.   DIFILEEFFECT = packed record
  514.     dwSize: DWORD;
  515.     GuidEffect: TGUID;
  516.     lpDiEffect: PDIEffect;
  517.     szFriendlyName: array [0..MAX_PATH-1] of Char;
  518.   end;
  519.   {$EXTERNALSYM DIFILEEFFECT}
  520.   TDIFileEffect = DIFILEEFFECT;
  521.   TDIEnumEffectsInFileCallback = function (const Effect: TDIFileEffect; Data: Pointer): BOOL; stdcall;
  522.   {$NODEFINE TDIEnumEffectsInFileCallback}
  523.   {$HPPEMIT 'typedef LPDIENUMEFFECTSINFILECALLBACK TDIEnumEffectsInFileCallback;'}
  524. {$ENDIF} (* DIRECTINPUT_VERSION >= 0x0700 *)
  525. const
  526.   DIEFF_OBJECTIDS             = $00000001;
  527.   {$EXTERNALSYM DIEFF_OBJECTIDS}
  528.   DIEFF_OBJECTOFFSETS         = $00000002;
  529.   {$EXTERNALSYM DIEFF_OBJECTOFFSETS}
  530.   DIEFF_CARTESIAN             = $00000010;
  531.   {$EXTERNALSYM DIEFF_CARTESIAN}
  532.   DIEFF_POLAR                 = $00000020;
  533.   {$EXTERNALSYM DIEFF_POLAR}
  534.   DIEFF_SPHERICAL             = $00000040;
  535.   {$EXTERNALSYM DIEFF_SPHERICAL}
  536.   DIEP_DURATION               = $00000001;
  537.   {$EXTERNALSYM DIEP_DURATION}
  538.   DIEP_SAMPLEPERIOD           = $00000002;
  539.   {$EXTERNALSYM DIEP_SAMPLEPERIOD}
  540.   DIEP_GAIN                   = $00000004;
  541.   {$EXTERNALSYM DIEP_GAIN}
  542.   DIEP_TRIGGERBUTTON          = $00000008;
  543.   {$EXTERNALSYM DIEP_TRIGGERBUTTON}
  544.   DIEP_TRIGGERREPEATINTERVAL  = $00000010;
  545.   {$EXTERNALSYM DIEP_TRIGGERREPEATINTERVAL}
  546.   DIEP_AXES                   = $00000020;
  547.   {$EXTERNALSYM DIEP_AXES}
  548.   DIEP_DIRECTION              = $00000040;
  549.   {$EXTERNALSYM DIEP_DIRECTION}
  550.   DIEP_ENVELOPE               = $00000080;
  551.   {$EXTERNALSYM DIEP_ENVELOPE}
  552.   DIEP_TYPESPECIFICPARAMS     = $00000100;
  553.   {$EXTERNALSYM DIEP_TYPESPECIFICPARAMS}
  554. {$IFDEF DIRECTINPUT_VERSION_6}
  555.   DIEP_STARTDELAY             = $00000200;
  556.   {$EXTERNALSYM DIEP_STARTDELAY}
  557.   DIEP_ALLPARAMS_DX5          = $000001FF;
  558.   {$EXTERNALSYM DIEP_ALLPARAMS_DX5}
  559.   DIEP_ALLPARAMS              = $000003FF;
  560.   {$EXTERNALSYM DIEP_ALLPARAMS}
  561. {$ELSE} (* DIRECTINPUT_VERSION < 0x0600 *)
  562.   DIEP_ALLPARAMS              = $000001FF;
  563.   {$EXTERNALSYM DIEP_ALLPARAMS}
  564. {$ENDIF} (* DIRECTINPUT_VERSION ? 0x0600 *)
  565.   DIEP_START                  = $20000000;
  566.   {$EXTERNALSYM DIEP_START}
  567.   DIEP_NORESTART              = $40000000;
  568.   {$EXTERNALSYM DIEP_NORESTART}
  569.   DIEP_NODOWNLOAD             = $80000000;
  570.   {$EXTERNALSYM DIEP_NODOWNLOAD}
  571.   DIEB_NOTRIGGER              = $FFFFFFFF;
  572.   {$EXTERNALSYM DIEB_NOTRIGGER}
  573.   DIES_SOLO                   = $00000001;
  574.   {$EXTERNALSYM DIES_SOLO}
  575.   DIES_NODOWNLOAD             = $80000000;
  576.   {$EXTERNALSYM DIES_NODOWNLOAD}
  577.   DIEGES_PLAYING              = $00000001;
  578.   {$EXTERNALSYM DIEGES_PLAYING}
  579.   DIEGES_EMULATED             = $00000002;
  580.   {$EXTERNALSYM DIEGES_EMULATED}
  581. type
  582.   PDIEffEscape = ^TDIEffEscape;
  583.   DIEFFESCAPE = packed record
  584.     dwSize: DWORD;
  585.     dwCommand: DWORD;
  586.     lpvInBuffer: Pointer;
  587.     cbInBuffer: DWORD;
  588.     lpvOutBuffer: Pointer;
  589.     cbOutBuffer: DWORD;
  590.   end;
  591.   {$EXTERNALSYM DIEFFESCAPE}
  592.   TDIEffEscape = DIEFFESCAPE;
  593. type
  594.   {$EXTERNALSYM IDirectInputEffect}
  595.   IDirectInputEffect = interface(IUnknown)
  596.     [SID_IDirectInputEffect]
  597.     (*** IDirectInputEffect methods ***)
  598.     function Initialize(hinst: THandle; dwVersion: DWORD; const rguid: TGUID): HResult; stdcall;
  599.     function GetEffectGuid(out pguid: TGUID): HResult; stdcall;
  600.     function GetParameters(var peff: TDIEffect; dwFlags: DWORD): HResult; stdcall;
  601.     function SetParameters(const peff: TDIEffect; dwFlags: DWORD): HResult; stdcall;
  602.     function Start(dwIterations, dwFlags: DWORD): HResult; stdcall;
  603.     function Stop: HResult; stdcall;
  604.     function GetEffectStatus(out pdwFlags: DWORD): HResult; stdcall;
  605.     function Download: HResult; stdcall;
  606.     function Unload: HResult; stdcall;
  607.     function Escape(var pesc: PDIEffEscape): HResult; stdcall;
  608.   end;
  609. {$ENDIF} (* DIRECTINPUT_VERSION >= 0x0500 *)
  610. (****************************************************************************
  611.  *
  612.  *      IDirectInputDevice
  613.  *
  614.  ****************************************************************************)
  615. const
  616. {$IFNDEF DIRECTINPUT_VERSION_8} (* #if DIRECTINPUT_VERSION <= 0x700 *)
  617.   DIDEVTYPE_DEVICE        = 1;
  618.   {$EXTERNALSYM DIDEVTYPE_DEVICE}
  619.   DIDEVTYPE_MOUSE         = 2;
  620.   {$EXTERNALSYM DIDEVTYPE_MOUSE}
  621.   DIDEVTYPE_KEYBOARD      = 3;
  622.   {$EXTERNALSYM DIDEVTYPE_KEYBOARD}
  623.   DIDEVTYPE_JOYSTICK      = 4;
  624.   {$EXTERNALSYM DIDEVTYPE_JOYSTICK}
  625. {$ELSE}
  626.   DI8DEVCLASS_ALL             = 0;
  627.   {$EXTERNALSYM DI8DEVCLASS_ALL}
  628.   DI8DEVCLASS_DEVICE          = 1;
  629.   {$EXTERNALSYM DI8DEVCLASS_DEVICE}
  630.   DI8DEVCLASS_POINTER         = 2;
  631.   {$EXTERNALSYM DI8DEVCLASS_POINTER}
  632.   DI8DEVCLASS_KEYBOARD        = 3;
  633.   {$EXTERNALSYM DI8DEVCLASS_KEYBOARD}
  634.   DI8DEVCLASS_GAMECTRL        = 4;
  635.   {$EXTERNALSYM DI8DEVCLASS_GAMECTRL}
  636.   DI8DEVTYPE_DEVICE           = $11;
  637.   {$EXTERNALSYM DI8DEVTYPE_DEVICE}
  638.   DI8DEVTYPE_MOUSE            = $12;
  639.   {$EXTERNALSYM DI8DEVTYPE_MOUSE}
  640.   DI8DEVTYPE_KEYBOARD         = $13;
  641.   {$EXTERNALSYM DI8DEVTYPE_KEYBOARD}
  642.   DI8DEVTYPE_JOYSTICK         = $14;
  643.   {$EXTERNALSYM DI8DEVTYPE_JOYSTICK}
  644.   DI8DEVTYPE_GAMEPAD          = $15;
  645.   {$EXTERNALSYM DI8DEVTYPE_GAMEPAD}
  646.   DI8DEVTYPE_DRIVING          = $16;
  647.   {$EXTERNALSYM DI8DEVTYPE_DRIVING}
  648.   DI8DEVTYPE_FLIGHT           = $17;
  649.   {$EXTERNALSYM DI8DEVTYPE_FLIGHT}
  650.   DI8DEVTYPE_1STPERSON        = $18;
  651.   {$EXTERNALSYM DI8DEVTYPE_1STPERSON}
  652.   DI8DEVTYPE_DEVICECTRL       = $19;
  653.   {$EXTERNALSYM DI8DEVTYPE_DEVICECTRL}
  654.   DI8DEVTYPE_SCREENPOINTER    = $1A;
  655.   {$EXTERNALSYM DI8DEVTYPE_SCREENPOINTER}
  656.   DI8DEVTYPE_REMOTE           = $1B;
  657.   {$EXTERNALSYM DI8DEVTYPE_REMOTE}
  658.   DI8DEVTYPE_SUPPLEMENTAL     = $1C;
  659.   {$EXTERNALSYM DI8DEVTYPE_SUPPLEMENTAL}
  660. {$ENDIF} (* DIRECTINPUT_VERSION <= 0x700 *)
  661.   DIDEVTYPE_HID           = $00010000;
  662.   {$EXTERNALSYM DIDEVTYPE_HID}
  663. {$IFNDEF DIRECTINPUT_VERSION_8} (* #if DIRECTINPUT_VERSION <= 0x700 *)
  664.   DIDEVTYPEMOUSE_UNKNOWN          =  1;
  665.   {$EXTERNALSYM DIDEVTYPEMOUSE_UNKNOWN}
  666.   DIDEVTYPEMOUSE_TRADITIONAL      =  2;
  667.   {$EXTERNALSYM DIDEVTYPEMOUSE_TRADITIONAL}
  668.   DIDEVTYPEMOUSE_FINGERSTICK      =  3;
  669.   {$EXTERNALSYM DIDEVTYPEMOUSE_FINGERSTICK}
  670.   DIDEVTYPEMOUSE_TOUCHPAD         =  4;
  671.   {$EXTERNALSYM DIDEVTYPEMOUSE_TOUCHPAD}
  672.   DIDEVTYPEMOUSE_TRACKBALL        =  5;
  673.   {$EXTERNALSYM DIDEVTYPEMOUSE_TRACKBALL}
  674.   DIDEVTYPEKEYBOARD_UNKNOWN       =  0;
  675.   {$EXTERNALSYM DIDEVTYPEKEYBOARD_UNKNOWN}
  676.   DIDEVTYPEKEYBOARD_PCXT          =  1;
  677.   {$EXTERNALSYM DIDEVTYPEKEYBOARD_PCXT}
  678.   DIDEVTYPEKEYBOARD_OLIVETTI      =  2;
  679.   {$EXTERNALSYM DIDEVTYPEKEYBOARD_OLIVETTI}
  680.   DIDEVTYPEKEYBOARD_PCAT          =  3;
  681.   {$EXTERNALSYM DIDEVTYPEKEYBOARD_PCAT}
  682.   DIDEVTYPEKEYBOARD_PCENH         =  4;
  683.   {$EXTERNALSYM DIDEVTYPEKEYBOARD_PCENH}
  684.   DIDEVTYPEKEYBOARD_NOKIA1050     =  5;
  685.   {$EXTERNALSYM DIDEVTYPEKEYBOARD_NOKIA1050}
  686.   DIDEVTYPEKEYBOARD_NOKIA9140     =  6;
  687.   {$EXTERNALSYM DIDEVTYPEKEYBOARD_NOKIA9140}
  688.   DIDEVTYPEKEYBOARD_NEC98         =  7;
  689.   {$EXTERNALSYM DIDEVTYPEKEYBOARD_NEC98}
  690.   DIDEVTYPEKEYBOARD_NEC98LAPTOP   =  8;
  691.   {$EXTERNALSYM DIDEVTYPEKEYBOARD_NEC98LAPTOP}
  692.   DIDEVTYPEKEYBOARD_NEC98106      =  9;
  693.   {$EXTERNALSYM DIDEVTYPEKEYBOARD_NEC98106}
  694.   DIDEVTYPEKEYBOARD_JAPAN106      = 10;
  695.   {$EXTERNALSYM DIDEVTYPEKEYBOARD_JAPAN106}
  696.   DIDEVTYPEKEYBOARD_JAPANAX       = 11;
  697.   {$EXTERNALSYM DIDEVTYPEKEYBOARD_JAPANAX}
  698.   DIDEVTYPEKEYBOARD_J3100         = 12;
  699.   {$EXTERNALSYM DIDEVTYPEKEYBOARD_J3100}
  700.   DIDEVTYPEJOYSTICK_UNKNOWN       =  1;
  701.   {$EXTERNALSYM DIDEVTYPEJOYSTICK_UNKNOWN}
  702.   DIDEVTYPEJOYSTICK_TRADITIONAL   =  2;
  703.   {$EXTERNALSYM DIDEVTYPEJOYSTICK_TRADITIONAL}
  704.   DIDEVTYPEJOYSTICK_FLIGHTSTICK   =  3;
  705.   {$EXTERNALSYM DIDEVTYPEJOYSTICK_FLIGHTSTICK}
  706.   DIDEVTYPEJOYSTICK_GAMEPAD       =  4;
  707.   {$EXTERNALSYM DIDEVTYPEJOYSTICK_GAMEPAD}
  708.   DIDEVTYPEJOYSTICK_RUDDER        =  5;
  709.   {$EXTERNALSYM DIDEVTYPEJOYSTICK_RUDDER}
  710.   DIDEVTYPEJOYSTICK_WHEEL         =  6;
  711.   {$EXTERNALSYM DIDEVTYPEJOYSTICK_WHEEL}
  712.   DIDEVTYPEJOYSTICK_HEADTRACKER   =  7;
  713.   {$EXTERNALSYM DIDEVTYPEJOYSTICK_HEADTRACKER}
  714. {$ELSE}
  715.   DI8DEVTYPEMOUSE_UNKNOWN                     = 1;
  716.   {$EXTERNALSYM DI8DEVTYPEMOUSE_UNKNOWN}
  717.   DI8DEVTYPEMOUSE_TRADITIONAL                 = 2;
  718.   {$EXTERNALSYM DI8DEVTYPEMOUSE_TRADITIONAL}
  719.   DI8DEVTYPEMOUSE_FINGERSTICK                 = 3;
  720.   {$EXTERNALSYM DI8DEVTYPEMOUSE_FINGERSTICK}
  721.   DI8DEVTYPEMOUSE_TOUCHPAD                    = 4;
  722.   {$EXTERNALSYM DI8DEVTYPEMOUSE_TOUCHPAD}
  723.   DI8DEVTYPEMOUSE_TRACKBALL                   = 5;
  724.   {$EXTERNALSYM DI8DEVTYPEMOUSE_TRACKBALL}
  725.   DI8DEVTYPEMOUSE_ABSOLUTE                    = 6;
  726.   {$EXTERNALSYM DI8DEVTYPEMOUSE_ABSOLUTE}
  727.   DI8DEVTYPEKEYBOARD_UNKNOWN                  = 0;
  728.   {$EXTERNALSYM DI8DEVTYPEKEYBOARD_UNKNOWN}
  729.   DI8DEVTYPEKEYBOARD_PCXT                     = 1;
  730.   {$EXTERNALSYM DI8DEVTYPEKEYBOARD_PCXT}
  731.   DI8DEVTYPEKEYBOARD_OLIVETTI                 = 2;
  732.   {$EXTERNALSYM DI8DEVTYPEKEYBOARD_OLIVETTI}
  733.   DI8DEVTYPEKEYBOARD_PCAT                     = 3;
  734.   {$EXTERNALSYM DI8DEVTYPEKEYBOARD_PCAT}
  735.   DI8DEVTYPEKEYBOARD_PCENH                    = 4;
  736.   {$EXTERNALSYM DI8DEVTYPEKEYBOARD_PCENH}
  737.   DI8DEVTYPEKEYBOARD_NOKIA1050                = 5;
  738.   {$EXTERNALSYM DI8DEVTYPEKEYBOARD_NOKIA1050}
  739.   DI8DEVTYPEKEYBOARD_NOKIA9140                = 6;
  740.   {$EXTERNALSYM DI8DEVTYPEKEYBOARD_NOKIA9140}
  741.   DI8DEVTYPEKEYBOARD_NEC98                    = 7;
  742.   {$EXTERNALSYM DI8DEVTYPEKEYBOARD_NEC98}
  743.   DI8DEVTYPEKEYBOARD_NEC98LAPTOP              = 8;
  744.   {$EXTERNALSYM DI8DEVTYPEKEYBOARD_NEC98LAPTOP}
  745.   DI8DEVTYPEKEYBOARD_NEC98106                 = 9;
  746.   {$EXTERNALSYM DI8DEVTYPEKEYBOARD_NEC98106}
  747.   DI8DEVTYPEKEYBOARD_JAPAN106                 = 10;
  748.   {$EXTERNALSYM DI8DEVTYPEKEYBOARD_JAPAN106}
  749.   DI8DEVTYPEKEYBOARD_JAPANAX                  = 11;
  750.   {$EXTERNALSYM DI8DEVTYPEKEYBOARD_JAPANAX}
  751.   DI8DEVTYPEKEYBOARD_J3100                    = 12;
  752.   {$EXTERNALSYM DI8DEVTYPEKEYBOARD_J3100}
  753.   DI8DEVTYPE_LIMITEDGAMESUBTYPE               = 1;
  754.   {$EXTERNALSYM DI8DEVTYPE_LIMITEDGAMESUBTYPE}
  755.   DI8DEVTYPEJOYSTICK_LIMITED                  = DI8DEVTYPE_LIMITEDGAMESUBTYPE;
  756.   {$EXTERNALSYM DI8DEVTYPEJOYSTICK_LIMITED}
  757.   DI8DEVTYPEJOYSTICK_STANDARD                 = 2;
  758.   {$EXTERNALSYM DI8DEVTYPEJOYSTICK_STANDARD}
  759.   DI8DEVTYPEGAMEPAD_LIMITED                   = DI8DEVTYPE_LIMITEDGAMESUBTYPE;
  760.   {$EXTERNALSYM DI8DEVTYPEGAMEPAD_LIMITED}
  761.   DI8DEVTYPEGAMEPAD_STANDARD                  = 2;
  762.   {$EXTERNALSYM DI8DEVTYPEGAMEPAD_STANDARD}
  763.   DI8DEVTYPEGAMEPAD_TILT                      = 3;
  764.   {$EXTERNALSYM DI8DEVTYPEGAMEPAD_TILT}
  765.   DI8DEVTYPEDRIVING_LIMITED                   = DI8DEVTYPE_LIMITEDGAMESUBTYPE;
  766.   {$EXTERNALSYM DI8DEVTYPEDRIVING_LIMITED}
  767.   DI8DEVTYPEDRIVING_COMBINEDPEDALS            = 2;
  768.   {$EXTERNALSYM DI8DEVTYPEDRIVING_COMBINEDPEDALS}
  769.   DI8DEVTYPEDRIVING_DUALPEDALS                = 3;
  770.   {$EXTERNALSYM DI8DEVTYPEDRIVING_DUALPEDALS}
  771.   DI8DEVTYPEDRIVING_THREEPEDALS               = 4;
  772.   {$EXTERNALSYM DI8DEVTYPEDRIVING_THREEPEDALS}
  773.   DI8DEVTYPEDRIVING_HANDHELD                  = 5;
  774.   {$EXTERNALSYM DI8DEVTYPEDRIVING_HANDHELD}
  775.   DI8DEVTYPEFLIGHT_LIMITED                    = DI8DEVTYPE_LIMITEDGAMESUBTYPE;
  776.   {$EXTERNALSYM DI8DEVTYPEFLIGHT_LIMITED}
  777.   DI8DEVTYPEFLIGHT_STICK                      = 2;
  778.   {$EXTERNALSYM DI8DEVTYPEFLIGHT_STICK}
  779.   DI8DEVTYPEFLIGHT_YOKE                       = 3;
  780.   {$EXTERNALSYM DI8DEVTYPEFLIGHT_YOKE}
  781.   DI8DEVTYPEFLIGHT_RC                         = 4;
  782.   {$EXTERNALSYM DI8DEVTYPEFLIGHT_RC}
  783.   DI8DEVTYPE1STPERSON_LIMITED                 = DI8DEVTYPE_LIMITEDGAMESUBTYPE;
  784.   {$EXTERNALSYM DI8DEVTYPE1STPERSON_LIMITED}
  785.   DI8DEVTYPE1STPERSON_UNKNOWN                 = 2;
  786.   {$EXTERNALSYM DI8DEVTYPE1STPERSON_UNKNOWN}
  787.   DI8DEVTYPE1STPERSON_SIXDOF                  = 3;
  788.   {$EXTERNALSYM DI8DEVTYPE1STPERSON_SIXDOF}
  789.   DI8DEVTYPE1STPERSON_SHOOTER                 = 4;
  790.   {$EXTERNALSYM DI8DEVTYPE1STPERSON_SHOOTER}
  791.   DI8DEVTYPESCREENPTR_UNKNOWN                 = 2;
  792.   {$EXTERNALSYM DI8DEVTYPESCREENPTR_UNKNOWN}
  793.   DI8DEVTYPESCREENPTR_LIGHTGUN                = 3;
  794.   {$EXTERNALSYM DI8DEVTYPESCREENPTR_LIGHTGUN}
  795.   DI8DEVTYPESCREENPTR_LIGHTPEN                = 4;
  796.   {$EXTERNALSYM DI8DEVTYPESCREENPTR_LIGHTPEN}
  797.   DI8DEVTYPESCREENPTR_TOUCH                   = 5;
  798.   {$EXTERNALSYM DI8DEVTYPESCREENPTR_TOUCH}
  799.   DI8DEVTYPEREMOTE_UNKNOWN                    = 2;
  800.   {$EXTERNALSYM DI8DEVTYPEREMOTE_UNKNOWN}
  801.   DI8DEVTYPEDEVICECTRL_UNKNOWN                = 2;
  802.   {$EXTERNALSYM DI8DEVTYPEDEVICECTRL_UNKNOWN}
  803.   DI8DEVTYPEDEVICECTRL_COMMSSELECTION         = 3;
  804.   {$EXTERNALSYM DI8DEVTYPEDEVICECTRL_COMMSSELECTION}
  805.   DI8DEVTYPEDEVICECTRL_COMMSSELECTION_HARDWIRED = 4;
  806.   {$EXTERNALSYM DI8DEVTYPEDEVICECTRL_COMMSSELECTION_HARDWIRED}
  807.   DI8DEVTYPESUPPLEMENTAL_UNKNOWN              = 2;
  808.   {$EXTERNALSYM DI8DEVTYPESUPPLEMENTAL_UNKNOWN}
  809.   DI8DEVTYPESUPPLEMENTAL_2NDHANDCONTROLLER    = 3;
  810.   {$EXTERNALSYM DI8DEVTYPESUPPLEMENTAL_2NDHANDCONTROLLER}
  811.   DI8DEVTYPESUPPLEMENTAL_HEADTRACKER          = 4;
  812.   {$EXTERNALSYM DI8DEVTYPESUPPLEMENTAL_HEADTRACKER}
  813.   DI8DEVTYPESUPPLEMENTAL_HANDTRACKER          = 5;
  814.   {$EXTERNALSYM DI8DEVTYPESUPPLEMENTAL_HANDTRACKER}
  815.   DI8DEVTYPESUPPLEMENTAL_SHIFTSTICKGATE       = 6;
  816.   {$EXTERNALSYM DI8DEVTYPESUPPLEMENTAL_SHIFTSTICKGATE}
  817.   DI8DEVTYPESUPPLEMENTAL_SHIFTER              = 7;
  818.   {$EXTERNALSYM DI8DEVTYPESUPPLEMENTAL_SHIFTER}
  819.   DI8DEVTYPESUPPLEMENTAL_THROTTLE             = 8;
  820.   {$EXTERNALSYM DI8DEVTYPESUPPLEMENTAL_THROTTLE}
  821.   DI8DEVTYPESUPPLEMENTAL_SPLITTHROTTLE        = 9;
  822.   {$EXTERNALSYM DI8DEVTYPESUPPLEMENTAL_SPLITTHROTTLE}
  823.   DI8DEVTYPESUPPLEMENTAL_COMBINEDPEDALS       = 10;
  824.   {$EXTERNALSYM DI8DEVTYPESUPPLEMENTAL_COMBINEDPEDALS}
  825.   DI8DEVTYPESUPPLEMENTAL_DUALPEDALS           = 11;
  826.   {$EXTERNALSYM DI8DEVTYPESUPPLEMENTAL_DUALPEDALS}
  827.   DI8DEVTYPESUPPLEMENTAL_THREEPEDALS          = 12;
  828.   {$EXTERNALSYM DI8DEVTYPESUPPLEMENTAL_THREEPEDALS}
  829.   DI8DEVTYPESUPPLEMENTAL_RUDDERPEDALS         = 13;
  830.   {$EXTERNALSYM DI8DEVTYPESUPPLEMENTAL_RUDDERPEDALS}
  831. {$ENDIF} (* DIRECTINPUT_VERSION <= 0x700 *)
  832. // #define GET_DIDEVICE_TYPE(dwDevType)    LOBYTE(dwDevType)
  833. function GET_DIDEVICE_TYPE(dwDevType: DWORD): Byte;
  834. {$EXTERNALSYM GET_DIDEVICE_TYPE}
  835. // #define GET_DIDEVICE_SUBTYPE(dwDevType) HIBYTE(dwDevType)
  836. function GET_DIDEVICE_SUBTYPE(dwDevType: DWORD): Byte;
  837. {$EXTERNALSYM GET_DIDEVICE_SUBTYPE}
  838. {$IFDEF DIRECTINPUT_VERSION_5} (* #if(DIRECTINPUT_VERSION >= 0x0500) *)
  839. (* This structure is defined for DirectX 3.0 compatibility *)
  840. type
  841.   PDIDevCapsDX3 = ^TDIDevCapsDX3;
  842.   DIDEVCAPS_DX3 = packed record
  843.     dwSize:    DWORD;
  844.     dwFlags:   DWORD;
  845.     dwDevType: DWORD;
  846.     dwAxes:    DWORD;
  847.     dwButtons: DWORD;
  848.     dwPOVs:    DWORD;
  849.   end;
  850.   {$EXTERNALSYM DIDEVCAPS_DX3}
  851.   TDIDevCapsDX3 = DIDEVCAPS_DX3;
  852. {$ENDIF} (* DIRECTINPUT_VERSION >= 0x0500 *)
  853.   PDIDevCaps = ^TDIDevCaps;
  854.   DIDEVCAPS = packed record
  855.     dwSize: DWORD;
  856.     dwFlags: DWORD;
  857.     dwDevType: DWORD;
  858.     dwAxes: DWORD;
  859.     dwButtons: DWORD;
  860.     dwPOVs: DWORD;
  861. {$IFDEF DIRECTINPUT_VERSION_5} (* #if(DIRECTINPUT_VERSION >= 0x0500) *)
  862.     dwFFSamplePeriod: DWORD;
  863.     dwFFMinTimeResolution: DWORD;
  864.     dwFirmwareRevision: DWORD;
  865.     dwHardwareRevision: DWORD;
  866.     dwFFDriverVersion: DWORD;
  867. {$ENDIF} (* DIRECTINPUT_VERSION >= 0x0500 *)
  868.   end;
  869.   {$EXTERNALSYM DIDEVCAPS}
  870.   TDIDevCaps = DIDEVCAPS;
  871. const
  872.   DIDC_ATTACHED           = $00000001;
  873.   {$EXTERNALSYM DIDC_ATTACHED}
  874.   DIDC_POLLEDDEVICE       = $00000002;
  875.   {$EXTERNALSYM DIDC_POLLEDDEVICE}
  876.   DIDC_EMULATED           = $00000004;
  877.   {$EXTERNALSYM DIDC_EMULATED}
  878.   DIDC_POLLEDDATAFORMAT   = $00000008;
  879.   {$EXTERNALSYM DIDC_POLLEDDATAFORMAT}
  880. {$IFDEF DIRECTINPUT_VERSION_5} (* #if(DIRECTINPUT_VERSION >= 0x0500) *)
  881.   DIDC_FORCEFEEDBACK      = $00000100;
  882.   {$EXTERNALSYM DIDC_FORCEFEEDBACK}
  883.   DIDC_FFATTACK           = $00000200;
  884.   {$EXTERNALSYM DIDC_FFATTACK}
  885.   DIDC_FFFADE             = $00000400;
  886.   {$EXTERNALSYM DIDC_FFFADE}
  887.   DIDC_SATURATION         = $00000800;
  888.   {$EXTERNALSYM DIDC_SATURATION}
  889.   DIDC_POSNEGCOEFFICIENTS = $00001000;
  890.   {$EXTERNALSYM DIDC_POSNEGCOEFFICIENTS}
  891.   DIDC_POSNEGSATURATION   = $00002000;
  892.   {$EXTERNALSYM DIDC_POSNEGSATURATION}
  893.   DIDC_DEADBAND           = $00004000;
  894.   {$EXTERNALSYM DIDC_DEADBAND}
  895. {$ENDIF} (* DIRECTINPUT_VERSION >= 0x0500 *)
  896.   DIDC_STARTDELAY         = $00008000;
  897.   {$EXTERNALSYM DIDC_STARTDELAY}
  898. {$IFDEF DIRECTINPUT_VERSION_5b} (* #if(DIRECTINPUT_VERSION >= 0x050a) *)
  899.   DIDC_ALIAS              = $00010000;
  900.   {$EXTERNALSYM DIDC_ALIAS}
  901.   DIDC_PHANTOM            = $00020000;
  902.   {$EXTERNALSYM DIDC_PHANTOM}
  903. {$ENDIF} (* DIRECTINPUT_VERSION >= 0x050a *)
  904. {$IFDEF DIRECTINPUT_VERSION_8} (* #if(DIRECTINPUT_VERSION >= 0x0800) *)
  905.   DIDC_HIDDEN             = $00040000;
  906.   {$EXTERNALSYM DIDC_HIDDEN}
  907. {$ENDIF} (* DIRECTINPUT_VERSION >= 0x0800 *)
  908.   DIDFT_ALL           = $00000000;
  909.   {$EXTERNALSYM DIDFT_ALL}
  910.   DIDFT_RELAXIS       = $00000001;
  911.   {$EXTERNALSYM DIDFT_RELAXIS}
  912.   DIDFT_ABSAXIS       = $00000002;
  913.   {$EXTERNALSYM DIDFT_ABSAXIS}
  914.   DIDFT_AXIS          = $00000003;
  915.   {$EXTERNALSYM DIDFT_AXIS}
  916.   DIDFT_PSHBUTTON     = $00000004;
  917.   {$EXTERNALSYM DIDFT_PSHBUTTON}
  918.   DIDFT_TGLBUTTON     = $00000008;
  919.   {$EXTERNALSYM DIDFT_TGLBUTTON}
  920.   DIDFT_BUTTON        = $0000000C;
  921.   {$EXTERNALSYM DIDFT_BUTTON}
  922.   DIDFT_POV           = $00000010;
  923.   {$EXTERNALSYM DIDFT_POV}
  924.   DIDFT_COLLECTION    = $00000040;
  925.   {$EXTERNALSYM DIDFT_COLLECTION}
  926.   DIDFT_NODATA        = $00000080;
  927.   {$EXTERNALSYM DIDFT_NODATA}
  928.   DIDFT_ANYINSTANCE   = $00FFFF00;
  929.   {$EXTERNALSYM DIDFT_ANYINSTANCE}
  930.   DIDFT_INSTANCEMASK  = DIDFT_ANYINSTANCE;
  931.   {$EXTERNALSYM DIDFT_INSTANCEMASK}
  932. // #define DIDFT_MAKEINSTANCE(n) ((WORD)(n) << 8)
  933. function DIDFT_MAKEINSTANCE(n: Cardinal): Cardinal;
  934. {$EXTERNALSYM DIDFT_MAKEINSTANCE}
  935. // #define DIDFT_GETTYPE(n)     LOBYTE(n)
  936. function DIDFT_GETTYPE(n: Cardinal): Byte;
  937. {$EXTERNALSYM DIDFT_GETTYPE}
  938. // #define DIDFT_GETINSTANCE(n) LOWORD((n) >> 8)
  939. function DIDFT_GETINSTANCE(n: Cardinal): Cardinal;
  940. {$EXTERNALSYM DIDFT_GETINSTANCE}
  941. const
  942.   DIDFT_FFACTUATOR        = $01000000;
  943.   {$EXTERNALSYM DIDFT_FFACTUATOR}
  944.   DIDFT_FFEFFECTTRIGGER   = $02000000;
  945.   {$EXTERNALSYM DIDFT_FFEFFECTTRIGGER}
  946. {$IFDEF DIRECTINPUT_VERSION_5b} (* #if(DIRECTINPUT_VERSION >= 0x050a) *)
  947.   DIDFT_OUTPUT            = $10000000;
  948.   {$EXTERNALSYM DIDFT_OUTPUT}
  949.   DIDFT_VENDORDEFINED     = $04000000;
  950.   {$EXTERNALSYM DIDFT_VENDORDEFINED}
  951.   DIDFT_ALIAS             = $08000000;
  952.   {$EXTERNALSYM DIDFT_ALIAS}
  953. {$ENDIF} (* DIRECTINPUT_VERSION >= 0x050a *)
  954. // #define DIDFT_ENUMCOLLECTION(n) ((WORD)(n) << 8)
  955. function DIDFT_ENUMCOLLECTION(n: Cardinal): Cardinal;
  956. {$EXTERNALSYM DIDFT_ENUMCOLLECTION}
  957. const
  958.   DIDFT_NOCOLLECTION      = $00FFFF00;
  959.   {$EXTERNALSYM DIDFT_NOCOLLECTION}
  960. type
  961.   PDIObjectDataFormat = ^TDIObjectDataFormat;
  962.   _DIOBJECTDATAFORMAT = packed record
  963.     pguid: PGUID;
  964.     dwOfs: DWORD;
  965.     dwType: DWORD;
  966.     dwFlags: DWORD;
  967.   end;
  968.   {$EXTERNALSYM _DIOBJECTDATAFORMAT}
  969.   DIOBJECTDATAFORMAT = _DIOBJECTDATAFORMAT;
  970.   {$EXTERNALSYM DIOBJECTDATAFORMAT}
  971.   TDIObjectDataFormat = _DIOBJECTDATAFORMAT;
  972.   PDIDataFormat = ^TDIDataFormat;
  973.   _DIDATAFORMAT = packed record
  974.     dwSize: DWORD;
  975.     dwObjSize: DWORD;
  976.     dwFlags: DWORD;
  977.     dwDataSize: DWORD;
  978.     dwNumObjs: DWORD;
  979.     rgodf: PDIObjectDataFormat;
  980.   end;
  981.   {$EXTERNALSYM _DIDATAFORMAT}
  982.   DIDATAFORMAT = _DIDATAFORMAT;
  983.   {$EXTERNALSYM DIDATAFORMAT}
  984.   TDIDataFormat = _DIDATAFORMAT;
  985. const
  986.   DIDF_ABSAXIS            = $00000001;
  987.   {$EXTERNALSYM DIDF_ABSAXIS}
  988.   DIDF_RELAXIS            = $00000002;
  989.   {$EXTERNALSYM DIDF_RELAXIS}
  990. {$IFDEF DIRECTINPUT_VERSION_8} (* #if(DIRECTINPUT_VERSION > 0x0700) *)
  991. type
  992.   PDIActionA = ^TDIActionA;
  993.   PDIActionW = ^TDIActionW;
  994.   PDIAction = PDIActionA;
  995.   _DIACTIONA = packed record
  996.     uAppData: Pointer;
  997.     dwSemantic: DWORD;
  998.     dwFlags: DWORD;
  999.     case Byte of
  1000.       0: (
  1001.         lptszActionName: PAnsiChar;
  1002.         guidInstance: TGUID;
  1003.         dwObjID: DWORD;
  1004.         dwHow: DWORD;
  1005.        );
  1006.       1: (
  1007.         uResIdString: LongWord;
  1008.       );
  1009.   end;
  1010.   {$EXTERNALSYM _DIACTIONA}
  1011.   _DIACTIONW = packed record
  1012.     uAppData: Pointer;
  1013.     dwSemantic: DWORD;
  1014.     dwFlags: DWORD;
  1015.     case Byte of
  1016.       0: (
  1017.         lptszActionName: PWideChar;
  1018.         guidInstance: TGUID;
  1019.         dwObjID: DWORD;
  1020.         dwHow: DWORD;
  1021.        );
  1022.       1: (
  1023.         uResIdString: LongWord;
  1024.       );
  1025.   end;
  1026.   {$EXTERNALSYM _DIACTIONW}
  1027.   _DIACTION = _DIACTIONA;
  1028.   {$EXTERNALSYM _DIACTION}
  1029.   DIACTIONA = _DIACTIONA;
  1030.   {$EXTERNALSYM DIACTIONA}
  1031.   DIACTIONW = _DIACTIONW;
  1032.   {$EXTERNALSYM DIACTIONW}
  1033.   DIACTION = DIACTIONA;
  1034.   {$EXTERNALSYM DIACTION}
  1035.   TDIActionA = _DIACTIONA;
  1036.   TDIActionW = _DIACTIONW;
  1037.   TDIAction = TDIActionA;
  1038. const
  1039.   DIA_FORCEFEEDBACK       = $00000001;
  1040.   {$EXTERNALSYM DIA_FORCEFEEDBACK}
  1041.   DIA_APPMAPPED           = $00000002;
  1042.   {$EXTERNALSYM DIA_APPMAPPED}
  1043.   DIA_APPNOMAP            = $00000004;
  1044.   {$EXTERNALSYM DIA_APPNOMAP}
  1045.   DIA_NORANGE             = $00000008;
  1046.   {$EXTERNALSYM DIA_NORANGE}
  1047.   DIA_APPFIXED            = $00000010;
  1048.   {$EXTERNALSYM DIA_APPFIXED}
  1049.   DIAH_UNMAPPED           = $00000000;
  1050.   {$EXTERNALSYM DIAH_UNMAPPED}
  1051.   DIAH_USERCONFIG         = $00000001;
  1052.   {$EXTERNALSYM DIAH_USERCONFIG}
  1053.   DIAH_APPREQUESTED       = $00000002;
  1054.   {$EXTERNALSYM DIAH_APPREQUESTED}
  1055.   DIAH_HWAPP              = $00000004;
  1056.   {$EXTERNALSYM DIAH_HWAPP}
  1057.   DIAH_HWDEFAULT          = $00000008;
  1058.   {$EXTERNALSYM DIAH_HWDEFAULT}
  1059.   DIAH_DEFAULT            = $00000020;
  1060.   {$EXTERNALSYM DIAH_DEFAULT}
  1061.   DIAH_ERROR              = $80000000;
  1062.   {$EXTERNALSYM DIAH_ERROR}
  1063. type
  1064.   PDIActionFormatA = ^TDIActionFormatA;
  1065.   PDIActionFormatW = ^TDIActionFormatW;
  1066.   PDIActionFormat = PDIActionFormatA;
  1067.   _DIACTIONFORMATA = packed record
  1068.     dwSize        : DWORD;
  1069.     dwActionSize  : DWORD;
  1070.     dwDataSize    : DWORD;
  1071.     dwNumActions  : DWORD;
  1072.     rgoAction     : PDIActionA;
  1073.     guidActionMap : TGUID;
  1074.     dwGenre       : DWORD;
  1075.     dwBufferSize  : DWORD;
  1076.     lAxisMin      : Longint;
  1077.     lAxisMax      : Longint;
  1078.     hInstString   : THandle;
  1079.     ftTimeStamp   : TFileTime;
  1080.     dwCRC         : DWORD;
  1081.     tszActionMap  : array [0..MAX_PATH-1] of AnsiChar;
  1082.   end;
  1083.   {$EXTERNALSYM _DIACTIONFORMATA}
  1084.   _DIACTIONFORMATW = packed record
  1085.     dwSize        : DWORD;
  1086.     dwActionSize  : DWORD;
  1087.     dwDataSize    : DWORD;
  1088.     dwNumActions  : DWORD;
  1089.     rgoAction     : PDIActionW;
  1090.     guidActionMap : TGUID;
  1091.     dwGenre       : DWORD;
  1092.     dwBufferSize  : DWORD;
  1093.     lAxisMin      : Longint;
  1094.     lAxisMax      : Longint;
  1095.     hInstString   : THandle;
  1096.     ftTimeStamp   : TFileTime;
  1097.     dwCRC         : DWORD;
  1098.     tszActionMap  : array [0..MAX_PATH-1] of WideChar;
  1099.   end;
  1100.   {$EXTERNALSYM _DIACTIONFORMATW}
  1101.   _DIACTIONFORMAT = _DIACTIONFORMATA;
  1102.   {$EXTERNALSYM _DIACTIONFORMAT}
  1103.   DIACTIONFORMATA = _DIACTIONFORMATA;
  1104.   {$EXTERNALSYM DIACTIONFORMATA}
  1105.   DIACTIONFORMATW = _DIACTIONFORMATW;
  1106.   {$EXTERNALSYM DIACTIONFORMATW}
  1107.   DIACTIONFORMAT = DIACTIONFORMATA;
  1108.   {$EXTERNALSYM DIACTIONFORMAT}
  1109.   TDIActionFormatA = _DIACTIONFORMATA;
  1110.   TDIActionFormatW = _DIACTIONFORMATW;
  1111.   TDIActionFormat = TDIActionFormatA;
  1112. const
  1113.   DIAFTS_NEWDEVICELOW     = $FFFFFFFF;
  1114.   {$EXTERNALSYM DIAFTS_NEWDEVICELOW}
  1115.   DIAFTS_NEWDEVICEHIGH    = $FFFFFFFF;
  1116.   {$EXTERNALSYM DIAFTS_NEWDEVICEHIGH}
  1117.   DIAFTS_UNUSEDDEVICELOW  = $00000000;
  1118.   {$EXTERNALSYM DIAFTS_UNUSEDDEVICELOW}
  1119.   DIAFTS_UNUSEDDEVICEHIGH = $00000000;
  1120.   {$EXTERNALSYM DIAFTS_UNUSEDDEVICEHIGH}
  1121.   DIDBAM_DEFAULT          = $00000000;
  1122.   {$EXTERNALSYM DIDBAM_DEFAULT}
  1123.   DIDBAM_PRESERVE         = $00000001;
  1124.   {$EXTERNALSYM DIDBAM_PRESERVE}
  1125.   DIDBAM_INITIALIZE       = $00000002;
  1126.   {$EXTERNALSYM DIDBAM_INITIALIZE}
  1127.   DIDBAM_HWDEFAULTS       = $00000004;
  1128.   {$EXTERNALSYM DIDBAM_HWDEFAULTS}
  1129.   DIDSAM_DEFAULT          = $00000000;
  1130.   {$EXTERNALSYM DIDSAM_DEFAULT}
  1131.   DIDSAM_NOUSER           = $00000001;
  1132.   {$EXTERNALSYM DIDSAM_NOUSER}
  1133.   DIDSAM_FORCESAVE        = $00000002;
  1134.   {$EXTERNALSYM DIDSAM_FORCESAVE}
  1135.   DICD_DEFAULT            = $00000000;
  1136.   {$EXTERNALSYM DICD_DEFAULT}
  1137.   DICD_EDIT               = $00000001;
  1138.   {$EXTERNALSYM DICD_EDIT}
  1139. (*
  1140.  * The following definition is normally defined in d3dtypes.h
  1141.  *)
  1142. type
  1143.   TD3DColor = DXTypes.TD3DColor;
  1144.   {$NODEFINE TD3DColor}
  1145. {$HPPEMIT ''}
  1146. {$HPPEMIT '#ifndef D3DCOLOR_DEFINED_BCB'}
  1147. {$HPPEMIT 'typedef D3DCOLOR TD3DColor;'}
  1148. {$HPPEMIT '#define D3DCOLOR_DEFINED_BCB'}
  1149. {$HPPEMIT '#endif'}
  1150. {$HPPEMIT ''}
  1151. type
  1152.   PDIColorSet = ^TDIColorSet;
  1153.   _DICOLORSET = packed record
  1154.     dwSize: DWORD;
  1155.     cTextFore: TD3DColor;
  1156.     cTextHighlight: TD3DColor;
  1157.     cCalloutLine: TD3DColor;
  1158.     cCalloutHighlight: TD3DColor;
  1159.     cBorder: TD3DColor;
  1160.     cControlFill: TD3DColor;
  1161.     cHighlightFill: TD3DColor;
  1162.     cAreaFill: TD3DColor;
  1163.   end;
  1164.   {$EXTERNALSYM _DICOLORSET}
  1165.   DICOLORSET = _DICOLORSET;
  1166.   {$EXTERNALSYM DICOLORSET}
  1167.   TDIColorSet = _DICOLORSET;
  1168.   PDIConfigureDevicesParamsA = ^TDIConfigureDevicesParamsA;
  1169.   PDIConfigureDevicesParamsW = ^TDIConfigureDevicesParamsW;
  1170.   PDIConfigureDevicesParams = PDIConfigureDevicesParamsA;
  1171.   _DICONFIGUREDEVICESPARAMSA = packed record
  1172.      dwSize:         DWORD;
  1173.      dwcUsers:       DWORD;
  1174.      lptszUserNames: PAnsiChar;
  1175.      dwcFormats:     DWORD;
  1176.      lprgFormats:    PDIActionFormatA;
  1177.      hwnd:           HWND;
  1178.      dics:           TDIColorSet;
  1179.      lpUnkDDSTarget: IUnknown;
  1180.   end;
  1181.   {$EXTERNALSYM _DICONFIGUREDEVICESPARAMSA}
  1182.   _DICONFIGUREDEVICESPARAMSW = packed record
  1183.      dwSize:         DWORD;
  1184.      dwcUsers:       DWORD;
  1185.      lptszUserNames: PWideChar;
  1186.      dwcFormats:     DWORD;
  1187.      lprgFormats:    PDIActionFormatW;
  1188.      hwnd:           HWND;
  1189.      dics:           TDIColorSet;
  1190.      lpUnkDDSTarget: IUnknown;
  1191.   end;
  1192.   {$EXTERNALSYM _DICONFIGUREDEVICESPARAMSW}
  1193.   _DICONFIGUREDEVICESPARAMS = _DICONFIGUREDEVICESPARAMSA;
  1194.   {$EXTERNALSYM _DICONFIGUREDEVICESPARAMS}
  1195.   DICONFIGUREDEVICESPARAMSA = _DICONFIGUREDEVICESPARAMSA;
  1196.   {$EXTERNALSYM DICONFIGUREDEVICESPARAMSA}
  1197.   DICONFIGUREDEVICESPARAMSW = _DICONFIGUREDEVICESPARAMSW;
  1198.   {$EXTERNALSYM DICONFIGUREDEVICESPARAMSW}
  1199.   DICONFIGUREDEVICESPARAMS = DICONFIGUREDEVICESPARAMSA;
  1200.   {$EXTERNALSYM DICONFIGUREDEVICESPARAMS}
  1201.   TDIConfigureDevicesParamsA = _DICONFIGUREDEVICESPARAMSA;
  1202.   TDIConfigureDevicesParamsW = _DICONFIGUREDEVICESPARAMSW;
  1203.   TDIConfigureDevicesParams = TDIConfigureDevicesParamsA;
  1204. const
  1205.   DIDIFT_CONFIGURATION    = $00000001;
  1206.   {$EXTERNALSYM DIDIFT_CONFIGURATION}
  1207.   DIDIFT_OVERLAY          = $00000002;
  1208.   {$EXTERNALSYM DIDIFT_OVERLAY}
  1209.   DIDAL_CENTERED      = $00000000;
  1210.   {$EXTERNALSYM DIDAL_CENTERED}
  1211.   DIDAL_LEFTALIGNED   = $00000001;
  1212.   {$EXTERNALSYM DIDAL_LEFTALIGNED}
  1213.   DIDAL_RIGHTALIGNED  = $00000002;
  1214.   {$EXTERNALSYM DIDAL_RIGHTALIGNED}
  1215.   DIDAL_MIDDLE        = $00000000;
  1216.   {$EXTERNALSYM DIDAL_MIDDLE}
  1217.   DIDAL_TOPALIGNED    = $00000004;
  1218.   {$EXTERNALSYM DIDAL_TOPALIGNED}
  1219.   DIDAL_BOTTOMALIGNED = $00000008;
  1220.   {$EXTERNALSYM DIDAL_BOTTOMALIGNED}
  1221. type
  1222.   PDIDeviceImageInfoA = ^TDIDeviceImageInfoA;
  1223.   PDIDeviceImageInfoW = ^TDIDeviceImageInfoW;
  1224.   PDIDeviceImageInfo = PDIDeviceImageInfoA;
  1225.   _DIDEVICEIMAGEINFOA = packed record
  1226.     tszImagePath: array [0..MAX_PATH-1] of AnsiChar;
  1227.     dwFlags:         DWORD;
  1228.     // These are valid if DIDIFT_OVERLAY is present in dwFlags.
  1229.     dwViewID:        DWORD;
  1230.     rcOverlay:       TRect;
  1231.     dwObjID:         DWORD;
  1232.     dwcValidPts:     DWORD;
  1233.     rgptCalloutLine: array [0..4] of TPoint;
  1234.     rcCalloutRect:   TRect;
  1235.     dwTextAlign:     DWORD;
  1236.   end;
  1237.   {$EXTERNALSYM _DIDEVICEIMAGEINFOA}
  1238.   _DIDEVICEIMAGEINFOW = packed record
  1239.     tszImagePath: array [0..MAX_PATH-1] of WideChar;
  1240.     dwFlags:         DWORD;
  1241.     // These are valid if DIDIFT_OVERLAY is present in dwFlags.
  1242.     dwViewID:        DWORD;
  1243.     rcOverlay:       TRect;
  1244.     dwObjID:         DWORD;
  1245.     dwcValidPts:     DWORD;
  1246.     rgptCalloutLine: array [0..4] of TPoint;
  1247.     rcCalloutRect:   TRect;
  1248.     dwTextAlign:     DWORD;
  1249.   end;
  1250.   {$EXTERNALSYM _DIDEVICEIMAGEINFOW}
  1251.   _DIDEVICEIMAGEINFO = _DIDEVICEIMAGEINFOA;
  1252.   {$EXTERNALSYM _DIDEVICEIMAGEINFO}
  1253.   DIDEVICEIMAGEINFOA = _DIDEVICEIMAGEINFOA;
  1254.   {$EXTERNALSYM DIDEVICEIMAGEINFOA}
  1255.   DIDEVICEIMAGEINFOW = _DIDEVICEIMAGEINFOW;
  1256.   {$EXTERNALSYM DIDEVICEIMAGEINFOW}
  1257.   DIDEVICEIMAGEINFO = DIDEVICEIMAGEINFOA;
  1258.   {$EXTERNALSYM DIDEVICEIMAGEINFO}
  1259.   TDIDeviceImageInfoA = _DIDEVICEIMAGEINFOA;
  1260.   TDIDeviceImageInfoW = _DIDEVICEIMAGEINFOW;
  1261.   TDIDeviceImageInfo = TDIDeviceImageInfoA;
  1262.   PDIDeviceImageInfoHeaderA = ^TDIDeviceImageInfoHeaderA;
  1263.   PDIDeviceImageInfoHeaderW = ^TDIDeviceImageInfoHeaderW;
  1264.   PDIDeviceImageInfoHeader = PDIDeviceImageInfoHeaderA;
  1265.   _DIDEVICEIMAGEINFOHEADERA = packed record
  1266.     dwSize:             DWORD;
  1267.     dwSizeImageInfo:    DWORD;
  1268.     dwcViews:           DWORD;
  1269.     dwcButtons:         DWORD;
  1270.     dwcAxes:            DWORD;
  1271.     dwcPOVs:            DWORD;
  1272.     dwBufferSize:       DWORD;
  1273.     dwBufferUsed:       DWORD;
  1274.     lprgImageInfoArray: PDIDeviceImageInfoA;
  1275.   end;
  1276.   {$EXTERNALSYM _DIDEVICEIMAGEINFOHEADERA}
  1277.   _DIDEVICEIMAGEINFOHEADERW = packed record
  1278.     dwSize:             DWORD;
  1279.     dwSizeImageInfo:    DWORD;
  1280.     dwcViews:           DWORD;
  1281.     dwcButtons:         DWORD;
  1282.     dwcAxes:            DWORD;
  1283.     dwcPOVs:            DWORD;
  1284.     dwBufferSize:       DWORD;
  1285.     dwBufferUsed:       DWORD;
  1286.     lprgImageInfoArray: PDIDeviceImageInfoW;
  1287.   end;
  1288.   {$EXTERNALSYM _DIDEVICEIMAGEINFOHEADERW}
  1289.   _DIDEVICEIMAGEINFOHEADER = _DIDEVICEIMAGEINFOHEADERA;
  1290.   {$EXTERNALSYM _DIDEVICEIMAGEINFOHEADER}
  1291.   DIDEVICEIMAGEINFOHEADERA = _DIDEVICEIMAGEINFOHEADERA;
  1292.   {$EXTERNALSYM _DIDEVICEIMAGEINFOHEADERA}
  1293.   DIDEVICEIMAGEINFOHEADERW = _DIDEVICEIMAGEINFOHEADERW;
  1294.   {$EXTERNALSYM _DIDEVICEIMAGEINFOHEADERW}
  1295.   DIDEVICEIMAGEINFOHEADER = DIDEVICEIMAGEINFOHEADERA;
  1296.   {$EXTERNALSYM _DIDEVICEIMAGEINFOHEADER}
  1297.   TDIDeviceImageInfoHeaderA = _DIDEVICEIMAGEINFOHEADERA;
  1298.   TDIDeviceImageInfoHeaderW = _DIDEVICEIMAGEINFOHEADERW;
  1299.   TDIDeviceImageInfoHeader = TDIDeviceImageInfoHeaderA;
  1300. {$ENDIF} (* DIRECTINPUT_VERSION > 0x0700 *)
  1301. {$IFDEF DIRECTINPUT_VERSION_5} (* #if(DIRECTINPUT_VERSION >= 0x0500) *)
  1302. (* These structures are defined for DirectX 3.0 compatibility *)
  1303. type
  1304.   PDIDeviceObjectInstanceDX3A = ^TDIDeviceObjectInstanceDX3A;
  1305.   PDIDeviceObjectInstanceDX3W = ^TDIDeviceObjectInstanceDX3W;
  1306.   PDIDeviceObjectInstanceDX3 = PDIDeviceObjectInstanceDX3A;
  1307.   DIDEVICEOBJECTINSTANCE_DX3A = packed record
  1308.     dwSize:   DWORD;
  1309.     guidType: TGUID;
  1310.     dwOfs:    DWORD;
  1311.     dwType:   DWORD;
  1312.     dwFlags:  DWORD;
  1313.     tszName: array [0..MAX_PATH-1] of AnsiChar;
  1314.   end;
  1315.   {$EXTERNALSYM DIDEVICEOBJECTINSTANCE_DX3A}
  1316.   DIDEVICEOBJECTINSTANCE_DX3W = packed record
  1317.     dwSize:   DWORD;
  1318.     guidType: TGUID;
  1319.     dwOfs:    DWORD;
  1320.     dwType:   DWORD;
  1321.     dwFlags:  DWORD;
  1322.     tszName: array [0..MAX_PATH-1] of WideChar;
  1323.   end;
  1324.   {$EXTERNALSYM DIDEVICEOBJECTINSTANCE_DX3W}
  1325.   DIDEVICEOBJECTINSTANCE_DX3 = DIDEVICEOBJECTINSTANCE_DX3A;
  1326.   {$EXTERNALSYM DIDEVICEOBJECTINSTANCE_DX3}
  1327.   TDIDeviceObjectInstanceDX3A = DIDEVICEOBJECTINSTANCE_DX3A;
  1328.   TDIDeviceObjectInstanceDX3W = DIDEVICEOBJECTINSTANCE_DX3W;
  1329.   TDIDeviceObjectInstanceDX3 = TDIDeviceObjectInstanceDX3A;
  1330. {$ENDIF} (* DIRECTINPUT_VERSION >= 0x0500 *)
  1331. type
  1332.   PDIDeviceObjectInstanceA = ^TDIDeviceObjectInstanceA;
  1333.   PDIDeviceObjectInstanceW = ^TDIDeviceObjectInstanceW;
  1334.   PDIDeviceObjectInstance = PDIDeviceObjectInstanceA;
  1335.   DIDEVICEOBJECTINSTANCEA = packed record
  1336.     dwSize:              DWORD;
  1337.     guidType:            TGUID;
  1338.     dwOfs:               DWORD;
  1339.     dwType:              DWORD;
  1340.     dwFlags:             DWORD;
  1341.     tszName: array[0..MAX_PATH-1] of AnsiChar;
  1342. {$IFDEF DIRECTINPUT_VERSION_5} (* #if(DIRECTINPUT_VERSION >= 0x0500) *)
  1343.     dwFFMaxForce:        DWORD;
  1344.     dwFFForceResolution: DWORD;
  1345.     wCollectionNumber:   Word;
  1346.     wDesignatorIndex:    Word;
  1347.     wUsagePage:          Word;
  1348.     wUsage:              Word;
  1349.     dwDimension:         DWORD;
  1350.     wExponent:           Word;
  1351.     wReportId:           Word;
  1352. {$ENDIF} (* DIRECTINPUT_VERSION >= 0x0500 *)
  1353.   end;
  1354.   {$EXTERNALSYM DIDEVICEOBJECTINSTANCEA}
  1355.   DIDEVICEOBJECTINSTANCEW = packed record
  1356.     dwSize:              DWORD;
  1357.     guidType:            TGUID;
  1358.     dwOfs:               DWORD;
  1359.     dwType:              DWORD;
  1360.     dwFlags:             DWORD;
  1361.     tszName: array[0..MAX_PATH-1] of WideChar;
  1362. {$IFDEF DIRECTINPUT_VERSION_5} (* #if(DIRECTINPUT_VERSION >= 0x0500) *)
  1363.     dwFFMaxForce:        DWORD;
  1364.     dwFFForceResolution: DWORD;
  1365.     wCollectionNumber:   Word;
  1366.     wDesignatorIndex:    Word;
  1367.     wUsagePage:          Word;
  1368.     wUsage:              Word;
  1369.     dwDimension:         DWORD;
  1370.     wExponent:           Word;
  1371.     wReportId:           Word;
  1372. {$ENDIF} (* DIRECTINPUT_VERSION >= 0x0500 *)
  1373.   end;
  1374.   {$EXTERNALSYM DIDEVICEOBJECTINSTANCEW}
  1375.   DIDEVICEOBJECTINSTANCE = DIDEVICEOBJECTINSTANCEA;
  1376.   {$EXTERNALSYM DIDEVICEOBJECTINSTANCE}
  1377.   TDIDeviceObjectInstanceA = DIDEVICEOBJECTINSTANCEA;
  1378.   TDIDeviceObjectInstanceW = DIDEVICEOBJECTINSTANCEW;
  1379.   TDIDeviceObjectInstance = TDIDeviceObjectInstanceA;
  1380. type
  1381.   TDIEnumDeviceObjectsCallbackA = function (var lpddoi: TDIDeviceObjectInstanceA; pvRef : Pointer): BOOL; stdcall;
  1382.   {$EXTERNALSYM TDIEnumDeviceObjectsCallbackA}
  1383.   TDIEnumDeviceObjectsCallbackW = function (var lpddoi: TDIDeviceObjectInstanceW; pvRef : Pointer): BOOL; stdcall;
  1384.   {$EXTERNALSYM TDIEnumDeviceObjectsCallbackW}
  1385.   TDIEnumDeviceObjectsCallback = TDIEnumDeviceObjectsCallbackA;
  1386.   {$EXTERNALSYM TDIEnumDeviceObjectsCallback}
  1387. {$IFDEF DIRECTINPUT_VERSION_5} (* #if(DIRECTINPUT_VERSION >= 0x0500) *)
  1388. const
  1389.   DIDOI_FFACTUATOR        = $00000001;
  1390.   {$EXTERNALSYM DIDOI_FFACTUATOR}
  1391.   DIDOI_FFEFFECTTRIGGER   = $00000002;
  1392.   {$EXTERNALSYM DIDOI_FFEFFECTTRIGGER}
  1393.   DIDOI_POLLED            = $00008000;
  1394.   {$EXTERNALSYM DIDOI_POLLED}
  1395.   DIDOI_ASPECTPOSITION    = $00000100;
  1396.   {$EXTERNALSYM DIDOI_ASPECTPOSITION}
  1397.   DIDOI_ASPECTVELOCITY    = $00000200;
  1398.   {$EXTERNALSYM DIDOI_ASPECTVELOCITY}
  1399.   DIDOI_ASPECTACCEL       = $00000300;
  1400.   {$EXTERNALSYM DIDOI_ASPECTACCEL}
  1401.   DIDOI_ASPECTFORCE       = $00000400;
  1402.   {$EXTERNALSYM DIDOI_ASPECTFORCE}
  1403.   DIDOI_ASPECTMASK        = $00000F00;
  1404.   {$EXTERNALSYM DIDOI_ASPECTMASK}
  1405. {$ENDIF} (* DIRECTINPUT_VERSION >= 0x0500 *)
  1406. {$IFDEF DIRECTINPUT_VERSION_5b} (* #if(DIRECTINPUT_VERSION >= 0x050a) *)
  1407.   DIDOI_GUIDISUSAGE       = $00010000;
  1408.   {$EXTERNALSYM DIDOI_GUIDISUSAGE}
  1409. {$ENDIF} (* DIRECTINPUT_VERSION >= 0x050a *)
  1410. type
  1411.   PDIPropHeader = ^TDIPropHeader;
  1412.   DIPROPHEADER = packed record
  1413.     dwSize: DWORD;
  1414.     dwHeaderSize: DWORD;
  1415.     dwObj: DWORD;
  1416.     dwHow: DWORD;
  1417.   end;
  1418.   {$EXTERNALSYM DIPROPHEADER}
  1419.   TDIPropHeader = DIPROPHEADER;
  1420. const
  1421.   DIPH_DEVICE             = 0;
  1422.   {$EXTERNALSYM DIPH_DEVICE}
  1423.   DIPH_BYOFFSET           = 1;
  1424.   {$EXTERNALSYM DIPH_BYOFFSET}
  1425.   DIPH_BYID               = 2;
  1426.   {$EXTERNALSYM DIPH_BYID}
  1427. {$IFDEF DIRECTINPUT_VERSION_5b} (* #if(DIRECTINPUT_VERSION >= 0x050a) *)
  1428.   DIPH_BYUSAGE            = 3;
  1429.   {$EXTERNALSYM DIPH_BYUSAGE}
  1430. {$ENDIF} (* DIRECTINPUT_VERSION >= 0x050a *)
  1431. {$IFDEF DIRECTINPUT_VERSION_5b} (* #if(DIRECTINPUT_VERSION >= 0x050a) *)
  1432. // #define DIMAKEUSAGEDWORD(UsagePage, Usage) 
  1433. //                                 (DWORD)MAKELONG(Usage, UsagePage)
  1434. function DIMAKEUSAGEDWORD(UsagePage, Usage: Word): DWORD;
  1435. {$EXTERNALSYM DIMAKEUSAGEDWORD}
  1436. {$ENDIF} (* DIRECTINPUT_VERSION >= 0x050a *)
  1437. type
  1438.   PDIPropDWord = ^TDIPropDWord;
  1439.   DIPROPDWORD = packed record
  1440.     diph: TDIPropHeader;
  1441.     dwData: DWORD;
  1442.   end;
  1443.   {$EXTERNALSYM DIPROPDWORD}
  1444.   TDIPropDWord = DIPROPDWORD;
  1445. {$IFDEF DIRECTINPUT_VERSION_8} (* #if(DIRECTINPUT_VERSION >= 0x0800) *)
  1446.   PDIPropPointer = ^TDIPropPointer;
  1447.   DIPROPPOINTER = packed record
  1448.     diph: TDIPropHeader;
  1449.     uData: Pointer;
  1450.   end;
  1451.   {$EXTERNALSYM DIPROPPOINTER}
  1452.   TDIPropPointer = DIPROPPOINTER;
  1453. {$ENDIF} (* DIRECTINPUT_VERSION >= 0x0800 *)
  1454.   PDIPropRange = ^TDIPropRange;
  1455.   DIPROPRANGE = packed record
  1456.     diph: TDIPropHeader;
  1457.     lMin: Longint;
  1458.     lMax: Longint;
  1459.   end;
  1460.   {$EXTERNALSYM DIPROPRANGE}
  1461.   TDIPropRange = DIPROPRANGE;
  1462. const
  1463.   DIPROPRANGE_NOMIN       = $80000000;
  1464.   {$EXTERNALSYM DIPROPRANGE_NOMIN}
  1465.   DIPROPRANGE_NOMAX       = $7FFFFFFF;
  1466.   {$EXTERNALSYM DIPROPRANGE_NOMAX}
  1467. {$IFDEF DIRECTINPUT_VERSION_5b} (* #if(DIRECTINPUT_VERSION >= 0x050a) *)
  1468. type
  1469.   PDIPropCal = ^TDIPropCal;
  1470.   DIPROPCAL = packed record
  1471.     diph: TDIPropHeader;
  1472.     lMin: Longint;
  1473.     lCenter: Longint;
  1474.     lMax: Longint;
  1475.   end;
  1476.   {$EXTERNALSYM DIPROPCAL}
  1477.   TDIPropCal = DIPROPCAL;
  1478.   PDIPropCalPov = ^TDIPropCalPov;
  1479.   DIPROPCALPOV = packed record
  1480.     diph: TDIPropHeader;
  1481.     lMin: array[0..4] of Longint;
  1482.     lMax: array[0..4] of Longint;
  1483.   end;
  1484.   {$EXTERNALSYM DIPROPCALPOV}
  1485.   TDIPropCalPov = DIPROPCALPOV;
  1486.   PDIPropGuidAndPath = ^TDIPropGuidAndPath;
  1487.   DIPROPGUIDANDPATH = packed record
  1488.     diph: TDIPropHeader;
  1489.     guidClass: TGUID;
  1490.     wszPath: array[0..MAX_PATH-1] of WideChar;
  1491.   end;
  1492.   {$EXTERNALSYM DIPROPGUIDANDPATH}
  1493.   TDIPropGuidAndPath = DIPROPGUIDANDPATH;
  1494.   PDIPropString = ^TDIPropString;
  1495.   DIPROPSTRING = packed record
  1496.     diph: TDIPropHeader;
  1497.     wsz: array[0..MAX_PATH-1] of WideChar;
  1498.   end;
  1499.   {$EXTERNALSYM DIPROPSTRING}
  1500.   TDIPropString = DIPROPSTRING;
  1501. {$ENDIF} (* DIRECTINPUT_VERSION >= 0x050a *)
  1502. {$IFDEF DIRECTINPUT_VERSION_8} (* #if(DIRECTINPUT_VERSION >= 0x0800) *)
  1503. const
  1504.   MAXCPOINTSNUM          = 8;
  1505.   {$EXTERNALSYM MAXCPOINTSNUM}
  1506. type
  1507.   PCPoint = ^TCPoint;
  1508.   _CPOINT = packed record
  1509.     lP: Longint;   // raw value
  1510.     dwLog: DWORD;  // logical_value / max_logical_value * 10000
  1511.   end;
  1512.   {$EXTERNALSYM _CPOINT}
  1513.   CPOINT = _CPOINT;
  1514.   {$EXTERNALSYM CPOINT}
  1515.   TCPoint = _CPOINT;
  1516.   PDIPropCPoints = ^TDIPropCPoints;
  1517.   DIPROPCPOINTS = packed record
  1518.     diph: TDIPropHeader;
  1519.     dwCPointsNum: DWORD;
  1520.     cp: array[0..MAXCPOINTSNUM-1] of TCPoint;
  1521.   end;
  1522.   {$EXTERNALSYM DIPROPCPOINTS}
  1523.   TDIPropCPoints = DIPROPCPOINTS;
  1524. {$ENDIF} (* DIRECTINPUT_VERSION >= 0x0800 *)
  1525. // #define MAKEDIPROP(prop)    (*(const GUID *)(prop))
  1526. type
  1527.   MAKEDIPROP = PGUID;
  1528.   {$EXTERNALSYM MAKEDIPROP}
  1529. const
  1530.   DIPROP_BUFFERSIZE       = MAKEDIPROP(1);
  1531.   {$EXTERNALSYM DIPROP_BUFFERSIZE}
  1532.   DIPROP_AXISMODE         = MAKEDIPROP(2);
  1533.   {$EXTERNALSYM DIPROP_AXISMODE}
  1534.   DIPROPAXISMODE_ABS      = 0;
  1535.   {$EXTERNALSYM DIPROPAXISMODE_ABS}
  1536.   DIPROPAXISMODE_REL      = 1;
  1537.   {$EXTERNALSYM DIPROPAXISMODE_REL}
  1538.   DIPROP_GRANULARITY      = MAKEDIPROP(3);
  1539.   {$EXTERNALSYM DIPROP_GRANULARITY}
  1540.   DIPROP_RANGE            = MAKEDIPROP(4);
  1541.   {$EXTERNALSYM DIPROP_RANGE}
  1542.   DIPROP_DEADZONE         = MAKEDIPROP(5);
  1543.   {$EXTERNALSYM DIPROP_DEADZONE}
  1544.   DIPROP_SATURATION       = MAKEDIPROP(6);
  1545.   {$EXTERNALSYM DIPROP_SATURATION}
  1546.   DIPROP_FFGAIN           = MAKEDIPROP(7);
  1547.   {$EXTERNALSYM DIPROP_FFGAIN}
  1548.   DIPROP_FFLOAD           = MAKEDIPROP(8);
  1549.   {$EXTERNALSYM DIPROP_FFLOAD}
  1550.   DIPROP_AUTOCENTER       = MAKEDIPROP(9);
  1551.   {$EXTERNALSYM DIPROP_AUTOCENTER}
  1552.   DIPROPAUTOCENTER_OFF    = 0;
  1553.   {$EXTERNALSYM DIPROPAUTOCENTER_OFF}
  1554.   DIPROPAUTOCENTER_ON     = 1;
  1555.   {$EXTERNALSYM DIPROPAUTOCENTER_ON}
  1556.   DIPROP_CALIBRATIONMODE  = MAKEDIPROP(10);
  1557.   {$EXTERNALSYM DIPROP_CALIBRATIONMODE}
  1558.   DIPROPCALIBRATIONMODE_COOKED    = 0;
  1559.   {$EXTERNALSYM DIPROPCALIBRATIONMODE_COOKED}
  1560.   DIPROPCALIBRATIONMODE_RAW       = 1;
  1561.   {$EXTERNALSYM DIPROPCALIBRATIONMODE_RAW}
  1562. {$IFDEF DIRECTINPUT_VERSION_5b} (* #if(DIRECTINPUT_VERSION >= 0x050a) *)
  1563.   DIPROP_CALIBRATION      = MAKEDIPROP(11);
  1564.   {$EXTERNALSYM DIPROP_CALIBRATION}
  1565.   DIPROP_GUIDANDPATH      = MAKEDIPROP(12);
  1566.   {$EXTERNALSYM DIPROP_GUIDANDPATH}
  1567.   DIPROP_INSTANCENAME     = MAKEDIPROP(13);
  1568.   {$EXTERNALSYM DIPROP_INSTANCENAME}
  1569.   DIPROP_PRODUCTNAME      = MAKEDIPROP(14);
  1570.   {$EXTERNALSYM DIPROP_PRODUCTNAME}
  1571. {$ENDIF} (* DIRECTINPUT_VERSION >= 0x050a *)
  1572. {$IFDEF DIRECTINPUT_VERSION_5b} (* #if(DIRECTINPUT_VERSION >= 0x05b2) *)
  1573.   DIPROP_JOYSTICKID       = MAKEDIPROP(15);
  1574.   {$EXTERNALSYM DIPROP_JOYSTICKID}
  1575.   DIPROP_GETPORTDISPLAYNAME = MAKEDIPROP(16);
  1576.   {$EXTERNALSYM DIPROP_GETPORTDISPLAYNAME}
  1577. {$ENDIF} (* DIRECTINPUT_VERSION >= 0x05b2 *)
  1578. {$IFDEF DIRECTINPUT_VERSION_7} (* #if(DIRECTINPUT_VERSION >= 0x0700) *)
  1579.   DIPROP_PHYSICALRANGE    = MAKEDIPROP(18);
  1580.   {$EXTERNALSYM DIPROP_PHYSICALRANGE}
  1581.   DIPROP_LOGICALRANGE     = MAKEDIPROP(19);
  1582.   {$EXTERNALSYM DIPROP_LOGICALRANGE}
  1583. {$ENDIF} (* DIRECTINPUT_VERSION >= 0x0700 *)
  1584. {$IFDEF DIRECTINPUT_VERSION_8} (* #if(DIRECTINPUT_VERSION >= 0x0800) *)
  1585.   DIPROP_KEYNAME          = MAKEDIPROP(20);
  1586.   {$EXTERNALSYM DIPROP_KEYNAME}
  1587.   DIPROP_CPOINTS          = MAKEDIPROP(21);
  1588.   {$EXTERNALSYM DIPROP_CPOINTS}
  1589.   DIPROP_APPDATA          = MAKEDIPROP(22);
  1590.   {$EXTERNALSYM DIPROP_APPDATA}
  1591.   DIPROP_SCANCODE         = MAKEDIPROP(23);
  1592.   {$EXTERNALSYM DIPROP_SCANCODE}
  1593.   DIPROP_VIDPID           = MAKEDIPROP(24);
  1594.   {$EXTERNALSYM DIPROP_VIDPID}
  1595.   DIPROP_USERNAME         = MAKEDIPROP(25);
  1596.   {$EXTERNALSYM DIPROP_USERNAME}
  1597.   DIPROP_TYPENAME         = MAKEDIPROP(26);
  1598.   {$EXTERNALSYM DIPROP_TYPENAME}
  1599. {$ENDIF} (* DIRECTINPUT_VERSION >= 0x0800 *)
  1600. type
  1601.   PDIDeviceObjectDataDX3 = ^TDIDeviceObjectDataDX3;
  1602.   DIDEVICEOBJECTDATA_DX3 = packed record
  1603.     dwOfs: DWORD;
  1604.     dwData: DWORD;
  1605.     dwTimeStamp: DWORD;
  1606.     dwSequence: DWORD;
  1607.   end;
  1608.   {$EXTERNALSYM DIDEVICEOBJECTDATA_DX3}
  1609.   TDIDeviceObjectDataDX3 = DIDEVICEOBJECTDATA_DX3;
  1610.   PDIDeviceObjectData = ^TDIDeviceObjectData;
  1611.   DIDEVICEOBJECTDATA = packed record
  1612.     dwOfs: DWORD;
  1613.     dwData: DWORD;
  1614.     dwTimeStamp: DWORD;
  1615.     dwSequence: DWORD;
  1616. {$IFDEF DIRECTINPUT_VERSION_8} (* #if(DIRECTINPUT_VERSION >= 0x0800) *)
  1617.     uAppData: Pointer;
  1618. {$ENDIF} (* DIRECTINPUT_VERSION >= 0x0800 *)
  1619.   end;
  1620.   {$EXTERNALSYM DIDEVICEOBJECTDATA}
  1621.   TDIDeviceObjectData = DIDEVICEOBJECTDATA;
  1622. const
  1623.   DIGDD_PEEK          = $00000001;
  1624.   {$EXTERNALSYM DIGDD_PEEK}
  1625. // #define DISEQUENCE_COMPARE(dwSequence1, cmp, dwSequence2) 
  1626. //                         ((int)((dwSequence1) - (dwSequence2)) cmp 0)
  1627. // Translator: This is not convertable to pascal   
  1628. const
  1629.   DISCL_EXCLUSIVE     = $00000001;
  1630.   {$EXTERNALSYM DISCL_EXCLUSIVE}
  1631.   DISCL_NONEXCLUSIVE  = $00000002;
  1632.   {$EXTERNALSYM DISCL_NONEXCLUSIVE}
  1633.   DISCL_FOREGROUND    = $00000004;
  1634.   {$EXTERNALSYM DISCL_FOREGROUND}
  1635.   DISCL_BACKGROUND    = $00000008;
  1636.   {$EXTERNALSYM DISCL_BACKGROUND}
  1637.   DISCL_NOWINKEY      = $00000010;
  1638.   {$EXTERNALSYM DISCL_NOWINKEY}
  1639. {$IFDEF DIRECTINPUT_VERSION_5} (* #if(DIRECTINPUT_VERSION >= 0x0500) *)
  1640. (* These structures are defined for DirectX 3.0 compatibility *)
  1641. type
  1642.   PDIDeviceInstanceDX3A = ^TDIDeviceInstanceDX3A;
  1643.   PDIDeviceInstanceDX3W = ^TDIDeviceInstanceDX3W;
  1644.   PDIDeviceInstanceDX3 = PDIDeviceInstanceDX3A;
  1645.   DIDEVICEINSTANCE_DX3A = packed record
  1646.     dwSize: DWORD;
  1647.     guidInstance: TGUID;
  1648.     guidProduct: TGUID;
  1649.     dwDevType: DWORD;
  1650.     tszInstanceName: array[0..MAX_PATH-1] of AnsiChar;
  1651.     tszProductName: array[0..MAX_PATH-1] of AnsiChar;
  1652.   end;
  1653.   {$EXTERNALSYM DIDEVICEINSTANCE_DX3A}
  1654.   DIDEVICEINSTANCE_DX3W = packed record
  1655.     dwSize: DWORD;
  1656.     guidInstance: TGUID;
  1657.     guidProduct: TGUID;
  1658.     dwDevType: DWORD;
  1659.     tszInstanceName: array[0..MAX_PATH-1] of WideChar;
  1660.     tszProductName: array[0..MAX_PATH-1] of WideChar;
  1661.   end;
  1662.   {$EXTERNALSYM DIDEVICEINSTANCE_DX3W}
  1663.   DIDEVICEINSTANCE_DX3 = DIDEVICEINSTANCE_DX3A;
  1664.   {$EXTERNALSYM DIDEVICEINSTANCE_DX3}
  1665.   TDIDeviceInstanceDX3A = DIDEVICEINSTANCE_DX3A;
  1666.   TDIDeviceInstanceDX3W = DIDEVICEINSTANCE_DX3W;
  1667.   TDIDeviceInstanceDX3 = TDIDeviceInstanceDX3A;
  1668. {$ENDIF} (* DIRECTINPUT_VERSION >= 0x0500 *)
  1669. type
  1670.   PDIDeviceInstanceA = ^TDIDeviceInstanceA;
  1671.   PDIDeviceInstanceW = ^TDIDeviceInstanceW;
  1672.   PDIDeviceInstance = PDIDeviceInstanceA;
  1673.   DIDEVICEINSTANCEA = packed record
  1674.     dwSize: DWORD;
  1675.     guidInstance: TGUID;
  1676.     guidProduct: TGUID;
  1677.     dwDevType: DWORD;
  1678.     tszInstanceName: array[0..MAX_PATH-1] of AnsiChar;
  1679.     tszProductName: array[0..MAX_PATH-1] of AnsiChar;
  1680. {$IFDEF DIRECTINPUT_VERSION_5} (* #if(DIRECTINPUT_VERSION >= 0x0500) *)
  1681.     guidFFDriver: TGUID;
  1682.     wUsagePage: Word;
  1683.     wUsage: Word;
  1684. {$ENDIF} (* DIRECTINPUT_VERSION >= 0x0500 *)
  1685.   end;
  1686.   {$EXTERNALSYM DIDEVICEINSTANCEA}
  1687.   DIDEVICEINSTANCEW = packed record
  1688.     dwSize: DWORD;
  1689.     guidInstance: TGUID;
  1690.     guidProduct: TGUID;
  1691.     dwDevType: DWORD;
  1692.     tszInstanceName: array[0..MAX_PATH-1] of WideChar;
  1693.     tszProductName: array[0..MAX_PATH-1] of WideChar;
  1694. {$IFDEF DIRECTINPUT_VERSION_5} (* #if(DIRECTINPUT_VERSION >= 0x0500) *)
  1695.     guidFFDriver: TGUID;
  1696.     wUsagePage: Word;
  1697.     wUsage: Word;
  1698. {$ENDIF} (* DIRECTINPUT_VERSION >= 0x0500 *)
  1699.   end;
  1700.   {$EXTERNALSYM DIDEVICEINSTANCEW}
  1701.   DIDEVICEINSTANCE = DIDEVICEINSTANCEA;
  1702.   {$EXTERNALSYM DIDEVICEINSTANCE}
  1703.   TDIDeviceInstanceA = DIDEVICEINSTANCEA;
  1704.   TDIDeviceInstanceW = DIDEVICEINSTANCEW;
  1705.   TDIDeviceInstance = TDIDeviceInstanceA;
  1706. type
  1707.   {$EXTERNALSYM IDirectInputDeviceA}
  1708.   IDirectInputDeviceA = interface(IUnknown)
  1709.     [SID_IDirectInputDeviceA]
  1710.     (*** IDirectInputDeviceA methods ***)
  1711.     function GetCapabilities(var lpDIDevCaps: TDIDevCaps): HResult; stdcall;
  1712.     function EnumObjects(lpCallback: TDIEnumDeviceObjectsCallbackA; pvRef: Pointer; dwFlags: DWORD): HResult; stdcall;
  1713.     function GetProperty(rguidProp: PGUID; var pdiph: TDIPropHeader): HResult; stdcall;
  1714.     function SetProperty(rguidProp: PGUID; const pdiph: TDIPropHeader): HResult; stdcall;
  1715.     function Acquire: HResult; stdcall;
  1716.     function Unacquire: HResult; stdcall;
  1717.     function GetDeviceState(cbData: DWORD; lpvData: Pointer): HResult; stdcall;
  1718.     function GetDeviceData(cbObjectData: DWORD; rgdod: PDIDeviceObjectData; out pdwInOut: DWORD; dwFlags: DWORD): HResult; stdcall;
  1719.     function SetDataFormat(var lpdf: TDIDataFormat): HResult; stdcall;
  1720.     function SetEventNotification(hEvent: THandle): HResult; stdcall;
  1721.     function SetCooperativeLevel(hwnd: HWND; dwFlags: DWORD): HResult; stdcall;
  1722.     function GetObjectInfo(var pdidoi: TDIDeviceObjectInstanceA; dwObj, dwHow: DWORD): HResult; stdcall;
  1723.     function GetDeviceInfo(var pdidi: TDIDeviceInstanceA): HResult; stdcall;
  1724.     function RunControlPanel(hwndOwner: HWND; dwFlags: DWORD): HResult; stdcall;
  1725.     function Initialize(hinst: THandle; dwVersion: DWORD; const rguid: TGUID): HResult; stdcall;
  1726.   end;
  1727.   {$EXTERNALSYM IDirectInputDeviceW}
  1728.   IDirectInputDeviceW = interface(IUnknown)
  1729.     [SID_IDirectInputDeviceW]
  1730.     (*** IDirectInputDeviceW methods ***)
  1731.     function GetCapabilities(var lpDIDevCaps: TDIDevCaps): HResult; stdcall;
  1732.     function EnumObjects(lpCallback: TDIEnumDeviceObjectsCallbackW; pvRef: Pointer; dwFlags: DWORD): HResult; stdcall;
  1733.     function GetProperty(rguidProp: PGUID; var pdiph: TDIPropHeader): HResult; stdcall;
  1734.     function SetProperty(rguidProp: PGUID; const pdiph: TDIPropHeader): HResult; stdcall;
  1735.     function Acquire: HResult; stdcall;
  1736.     function Unacquire: HResult; stdcall;
  1737.     function GetDeviceState(cbData: DWORD; lpvData: Pointer): HResult; stdcall;
  1738.     function GetDeviceData(cbObjectData: DWORD; rgdod: PDIDeviceObjectData; out pdwInOut: DWORD; dwFlags: DWORD): HResult; stdcall;
  1739.     function SetDataFormat(var lpdf: TDIDataFormat): HResult; stdcall;
  1740.     function SetEventNotification(hEvent: THandle): HResult; stdcall;
  1741.     function SetCooperativeLevel(hwnd: HWND; dwFlags: DWORD): HResult; stdcall;
  1742.     function GetObjectInfo(var pdidoi: TDIDeviceObjectInstanceW; dwObj, dwHow: DWORD): HResult; stdcall;
  1743.     function GetDeviceInfo(var pdidi: TDIDeviceInstanceW): HResult; stdcall;
  1744.     function RunControlPanel(hwndOwner: HWND; dwFlags: DWORD): HResult; stdcall;
  1745.     function Initialize(hinst: THandle; dwVersion: DWORD; const rguid: TGUID): HResult; stdcall;
  1746.   end;
  1747.   {$EXTERNALSYM IDirectInputDevice}
  1748.   IDirectInputDevice = IDirectInputDeviceA;
  1749. type
  1750.   IID_IDirectInputDevice = IDirectInputDevice;
  1751.   {$EXTERNALSYM IID_IDirectInputDevice}
  1752. {$IFDEF DIRECTINPUT_VERSION_5} (* #if(DIRECTINPUT_VERSION >= 0x0500) *)
  1753. const
  1754.   DISFFC_RESET            = $00000001;
  1755.   {$EXTERNALSYM DISFFC_RESET}
  1756.   DISFFC_STOPALL          = $00000002;
  1757.   {$EXTERNALSYM DISFFC_STOPALL}
  1758.   DISFFC_PAUSE            = $00000004;
  1759.   {$EXTERNALSYM DISFFC_PAUSE}
  1760.   DISFFC_CONTINUE         = $00000008;
  1761.   {$EXTERNALSYM DISFFC_CONTINUE}
  1762.   DISFFC_SETACTUATORSON   = $00000010;
  1763.   {$EXTERNALSYM DISFFC_SETACTUATORSON}
  1764.   DISFFC_SETACTUATORSOFF  = $00000020;
  1765.   {$EXTERNALSYM DISFFC_SETACTUATORSOFF}
  1766.   DIGFFS_EMPTY            = $00000001;
  1767.   {$EXTERNALSYM DIGFFS_EMPTY}
  1768.   DIGFFS_STOPPED          = $00000002;
  1769.   {$EXTERNALSYM DIGFFS_STOPPED}
  1770.   DIGFFS_PAUSED           = $00000004;
  1771.   {$EXTERNALSYM DIGFFS_PAUSED}
  1772.   DIGFFS_ACTUATORSON      = $00000010;
  1773.   {$EXTERNALSYM DIGFFS_ACTUATORSON}
  1774.   DIGFFS_ACTUATORSOFF     = $00000020;
  1775.   {$EXTERNALSYM DIGFFS_ACTUATORSOFF}
  1776.   DIGFFS_POWERON          = $00000040;
  1777.   {$EXTERNALSYM DIGFFS_POWERON}
  1778.   DIGFFS_POWEROFF         = $00000080;
  1779.   {$EXTERNALSYM DIGFFS_POWEROFF}
  1780.   DIGFFS_SAFETYSWITCHON   = $00000100;
  1781.   {$EXTERNALSYM DIGFFS_SAFETYSWITCHON}
  1782.   DIGFFS_SAFETYSWITCHOFF  = $00000200;
  1783.   {$EXTERNALSYM DIGFFS_SAFETYSWITCHOFF}
  1784.   DIGFFS_USERFFSWITCHON   = $00000400;
  1785.   {$EXTERNALSYM DIGFFS_USERFFSWITCHON}
  1786.   DIGFFS_USERFFSWITCHOFF  = $00000800;
  1787.   {$EXTERNALSYM DIGFFS_USERFFSWITCHOFF}
  1788.   DIGFFS_DEVICELOST       = $80000000;
  1789.   {$EXTERNALSYM DIGFFS_DEVICELOST}
  1790. type
  1791.   PDIEffectInfoA = ^TDIEffectInfoA;
  1792.   PDIEffectInfoW = ^TDIEffectInfoW;
  1793.   PDIEffectInfo = PDIEffectInfoA;
  1794.   DIEFFECTINFOA = packed record
  1795.     dwSize: DWORD;
  1796.     guid: TGUID;
  1797.     dwEffType: DWORD;
  1798.     dwStaticParams: DWORD;
  1799.     dwDynamicParams: DWORD;
  1800.     tszName: array[0..MAX_PATH-1] of AnsiChar;
  1801.   end;
  1802.   {$EXTERNALSYM DIEFFECTINFOA}
  1803.   DIEFFECTINFOW = packed record
  1804.     dwSize: DWORD;
  1805.     guid: TGUID;
  1806.     dwEffType: DWORD;
  1807.     dwStaticParams: DWORD;
  1808.     dwDynamicParams: DWORD;
  1809.     tszName: array[0..MAX_PATH-1] of WideChar;
  1810.   end;
  1811.   {$EXTERNALSYM DIEFFECTINFOW}
  1812.   DIEFFECTINFO = DIEFFECTINFOA;
  1813.   {$EXTERNALSYM DIEFFECTINFO}
  1814.   TDIEffectInfoA = DIEFFECTINFOA;
  1815.   TDIEffectInfoW = DIEFFECTINFOW;
  1816.   TDIEffectInfo = TDIEffectInfoA;
  1817. const
  1818.   DISDD_CONTINUE          = $00000001;
  1819.   {$EXTERNALSYM DISDD_CONTINUE}
  1820. type
  1821.   TDIEnumEffectsCallbackA = function (var pdei: TDIEffectInfoA; pvRef: Pointer): BOOL; stdcall;
  1822.   {$NODEFINE TDIEnumEffectsCallbackA}
  1823.   (*$HPPEMIT 'typedef LPDIENUMEFFECTSCALLBACKA TDIEnumEffectsCallbackA;'*)
  1824.   TDIEnumEffectsCallbackW = function (var pdei: TDIEffectInfoW; pvRef: Pointer): BOOL; stdcall;
  1825.   {$NODEFINE TDIEnumEffectsCallbackW}
  1826.   (*$HPPEMIT 'typedef LPDIENUMEFFECTSCALLBACKW TDIEnumEffectsCallbackW;'*)
  1827.   TDIEnumEffectsCallback = TDIEnumEffectsCallbackA;
  1828.   {$NODEFINE TDIEnumEffectsCallback}
  1829.   {$HPPEMIT 'typedef LPDIENUMEFFECTSINFILECALLBACK TDIEnumEffectsInFileCallback;'}
  1830.   TDIEnumCreatedEffectObjectsCallback = function (peff : IDirectInputEffect; pvRev: Pointer): BOOL; stdcall;
  1831.   {$NODEFINE TDIEnumCreatedEffectObjectsCallback}
  1832.   {$HPPEMIT 'typedef LPDIENUMCREATEDEFFECTOBJECTSCALLBACK TDIEnumCreatedEffectObjectsCallback;'}
  1833.   {$EXTERNALSYM IDirectInputDevice2A}
  1834.   IDirectInputDevice2A = interface(IDirectInputDeviceA)
  1835.     [SID_IDirectInputDevice2A]
  1836.     (*** IDirectInputDevice2A methods ***)
  1837.     function CreateEffect(const rguid: TGUID; lpeff: PDIEffect; out ppdeff: IDirectInputEffect; punkOuter: IUnknown): HResult; stdcall;
  1838.     function EnumEffects(lpCallback: TDIEnumEffectsCallbackA; pvRef: Pointer; dwEffType: DWORD): HResult; stdcall;
  1839.     function GetEffectInfo(var pdei: TDIEffectInfoA; const rguid: TGUID): HResult; stdcall;
  1840.     function GetForceFeedbackState(out pdwOut: DWORD): HResult; stdcall;
  1841.     function SendForceFeedbackCommand(dwFlags: DWORD): HResult; stdcall;
  1842.     function EnumCreatedEffectObjects(lpCallback: TDIEnumCreatedEffectObjectsCallback; pvRef: Pointer; fl: DWORD): HResult; stdcall;
  1843.     function Escape(var pesc: TDIEffEscape): HResult; stdcall;
  1844.     function Poll: HResult; stdcall;
  1845.     function SendDeviceData(cbObjectData: DWORD; rgdod: PDIDeviceObjectData; var pdwInOut: DWORD; fl: DWORD): HResult; stdcall;
  1846.   end;
  1847.   {$EXTERNALSYM IDirectInputDevice2W}
  1848.   IDirectInputDevice2W = interface(IDirectInputDeviceW)
  1849.     [SID_IDirectInputDevice2W]
  1850.     (*** IDirectInputDevice2W methods ***)
  1851.     function CreateEffect(const rguid: TGUID; lpeff: PDIEffect; out ppdeff: IDirectInputEffect; punkOuter: IUnknown): HResult; stdcall;
  1852.     function EnumEffects(lpCallback: TDIEnumEffectsCallbackW; pvRef: Pointer; dwEffType: DWORD): HResult; stdcall;
  1853.     function GetEffectInfo(var pdei: TDIEffectInfoW; const rguid: TGUID): HResult; stdcall;
  1854.     function GetForceFeedbackState(out pdwOut: DWORD): HResult; stdcall;
  1855.     function SendForceFeedbackCommand(dwFlags: DWORD): HResult; stdcall;
  1856.     function EnumCreatedEffectObjects(lpCallback: TDIEnumCreatedEffectObjectsCallback; pvRef: Pointer; fl: DWORD): HResult; stdcall;
  1857.     function Escape(var pesc: TDIEffEscape): HResult; stdcall;
  1858.     function Poll: HResult; stdcall;
  1859.     function SendDeviceData(cbObjectData: DWORD; rgdod: PDIDeviceObjectData; var pdwInOut: DWORD; fl: DWORD): HResult; stdcall;
  1860.   end;
  1861.   {$EXTERNALSYM IDirectInputDevice2}
  1862.   IDirectInputDevice2 = IDirectInputDevice2A;
  1863. type
  1864.   IID_IDirectInputDevice2 = IDirectInputDevice2;
  1865.   {$EXTERNALSYM IID_IDirectInputDevice2}
  1866. {$ENDIF} (* DIRECTINPUT_VERSION >= 0x0500 *)
  1867. {$IFDEF DIRECTINPUT_VERSION_7} (* #if(DIRECTINPUT_VERSION >= 0x0700) *)
  1868. const
  1869.   DIFEF_DEFAULT               = $00000000;
  1870.   {$EXTERNALSYM DIFEF_DEFAULT}
  1871.   DIFEF_INCLUDENONSTANDARD    = $00000001;
  1872.   {$EXTERNALSYM DIFEF_INCLUDENONSTANDARD}
  1873.   DIFEF_MODIFYIFNEEDED        = $00000010;
  1874.   {$EXTERNALSYM DIFEF_MODIFYIFNEEDED}
  1875. type
  1876.   {$EXTERNALSYM IDirectInputDevice7A}
  1877.   IDirectInputDevice7A = interface(IDirectInputDevice2A)
  1878.     [SID_IDirectInputDevice7A]
  1879.     (*** IDirectInputDevice7A methods ***)
  1880.     function EnumEffectsInFile(lpszFileName: PAnsiChar; pec: TDIEnumEffectsInFileCallback; pvRef: Pointer; dwFlags: DWORD): HResult; stdcall;
  1881.     function WriteEffectToFile(lpszFileName: PAnsiChar; dwEntries: DWORD; rgDiFileEft: PDIFileEffect; dwFlags: DWORD): HResult; stdcall;
  1882.   end;
  1883.   {$EXTERNALSYM IDirectInputDevice7W}
  1884.   IDirectInputDevice7W = interface(IDirectInputDevice2W)
  1885.     [SID_IDirectInputDevice7W]
  1886.     (*** IDirectInputDevice7W methods ***)
  1887.     function EnumEffectsInFile(lpszFileName: PWideChar; pec: TDIEnumEffectsInFileCallback; pvRef: Pointer; dwFlags: DWORD): HResult; stdcall;
  1888.     function WriteEffectToFile(lpszFileName: PWideChar; dwEntries: DWORD; rgDiFileEft: PDIFileEffect; dwFlags: DWORD): HResult; stdcall;
  1889.   end;
  1890.   {$EXTERNALSYM IDirectInputDevice7}
  1891.   IDirectInputDevice7 = IDirectInputDevice7A;
  1892. type
  1893.   IID_IDirectInputDevice7 = IDirectInputDevice7;
  1894.   {$EXTERNALSYM IID_IDirectInputDevice7}
  1895. {$ENDIF} (* DIRECTINPUT_VERSION >= 0x0700 *)
  1896. {$IFDEF DIRECTINPUT_VERSION_8} (* #if(DIRECTINPUT_VERSION >= 0x0800) *)
  1897. type
  1898.   {$EXTERNALSYM IDirectInputDevice8A}
  1899.   IDirectInputDevice8A = interface(IDirectInputDevice7A)
  1900.     [SID_IDirectInputDevice8A]
  1901.     (*** IDirectInputDevice8A methods ***)
  1902.     function BuildActionMap(lpdiaf: TDIActionFormatA; lpszUserName: PAnsiChar; dwFlags: DWORD): HResult; stdcall;
  1903.     function SetActionMap(var lpdiActionFormat: TDIActionFormatA; lptszUserName: PAnsiChar; dwFlags: DWORD): HResult; stdcall;
  1904.     function GetImageInfo(var lpdiDevImageInfoHeader: TDIDeviceImageInfoHeaderA): HResult; stdcall;
  1905.   end;
  1906.   {$EXTERNALSYM IDirectInputDevice8W}
  1907.   IDirectInputDevice8W = interface(IDirectInputDevice7W)
  1908.     [SID_IDirectInputDevice8W]
  1909.     (*** IDirectInputDevice8W methods ***)
  1910.     function BuildActionMap(lpdiaf: TDIActionFormatW; lpszUserName: PWideChar; dwFlags: DWORD): HResult; stdcall;
  1911.     function SetActionMap(var lpdiActionFormat: TDIActionFormatW; lptszUserName: PWideChar; dwFlags: DWORD): HResult; stdcall;
  1912.     function GetImageInfo(var lpdiDevImageInfoHeader: TDIDeviceImageInfoHeaderW): HResult; stdcall;
  1913.   end;
  1914.   {$EXTERNALSYM IDirectInputDevice8}
  1915.   IDirectInputDevice8 = IDirectInputDevice8A;
  1916. type
  1917.   IID_IDirectInputDevice8 = IDirectInputDevice8;
  1918.   {$EXTERNALSYM IID_IDirectInputDevice8}
  1919. {$ENDIF} (* DIRECTINPUT_VERSION >= 0x0800 *)
  1920. (****************************************************************************
  1921.  *
  1922.  *      Mouse
  1923.  *
  1924.  ****************************************************************************)
  1925. type
  1926.   PDIMouseState = ^TDIMouseState;
  1927.   _DIMOUSESTATE = packed record
  1928.     lX: Longint;
  1929.     lY: Longint;
  1930.     lZ: Longint;
  1931.     rgbButtons: array[0..3] of Byte;
  1932.   end;
  1933.   {$EXTERNALSYM _DIMOUSESTATE}
  1934.   DIMOUSESTATE = _DIMOUSESTATE;
  1935.   {$EXTERNALSYM DIMOUSESTATE}
  1936.   TDIMouseState = _DIMOUSESTATE;
  1937. {$IFDEF DIRECTINPUT_VERSION_7} (* #if(DIRECTINPUT_VERSION >= 0x0700) *)
  1938.   PDIMouseState2 = ^TDIMouseState2;
  1939.   _DIMOUSESTATE2 = packed record
  1940.     lX: Longint;
  1941.     lY: Longint;
  1942.     lZ: Longint;
  1943.     rgbButtons: array[0..7] of Byte;
  1944.   end;
  1945.   {$EXTERNALSYM _DIMOUSESTATE2}
  1946.   DIMOUSESTATE2 = _DIMOUSESTATE2;
  1947.   {$EXTERNALSYM DIMOUSESTATE2}
  1948.   TDIMouseState2 = _DIMOUSESTATE2;
  1949. {$ENDIF} (* DIRECTINPUT_VERSION >= 0x0700 *)
  1950. const
  1951.   DIMOFS_X        = 0; // FIELD_OFFSET(DIMOUSESTATE, lX)
  1952.   {$EXTERNALSYM DIMOFS_X}
  1953.   DIMOFS_Y        = 4; // FIELD_OFFSET(DIMOUSESTATE, lY)
  1954.   {$EXTERNALSYM DIMOFS_Y}
  1955.   DIMOFS_Z        = 8; // FIELD_OFFSET(DIMOUSESTATE, lZ)
  1956.   {$EXTERNALSYM DIMOFS_Z}
  1957.   DIMOFS_BUTTON0  = 12;                 // (FIELD_OFFSET(DIMOUSESTATE, rgbButtons) + 0)
  1958.   {$EXTERNALSYM DIMOFS_BUTTON0}
  1959.   DIMOFS_BUTTON1  = DIMOFS_BUTTON0 + 1; // (FIELD_OFFSET(DIMOUSESTATE, rgbButtons) + 1)
  1960.   {$EXTERNALSYM DIMOFS_BUTTON1}
  1961.   DIMOFS_BUTTON2  = DIMOFS_BUTTON0 + 2; // (FIELD_OFFSET(DIMOUSESTATE, rgbButtons) + 2)
  1962.   {$EXTERNALSYM DIMOFS_BUTTON2}
  1963.   DIMOFS_BUTTON3  = DIMOFS_BUTTON0 + 3; // (FIELD_OFFSET(DIMOUSESTATE, rgbButtons) + 3)
  1964.   {$EXTERNALSYM DIMOFS_BUTTON3}
  1965. {$IFDEF DIRECTINPUT_VERSION_7} (* #if(DIRECTINPUT_VERSION >= 0x0700) *)
  1966.   DIMOFS_BUTTON4  = DIMOFS_BUTTON0 + 4; // (FIELD_OFFSET(DIMOUSESTATE2, rgbButtons) + 4)
  1967.   {$EXTERNALSYM DIMOFS_BUTTON4}
  1968.   DIMOFS_BUTTON5  = DIMOFS_BUTTON0 + 5; // (FIELD_OFFSET(DIMOUSESTATE2, rgbButtons) + 5)
  1969.   {$EXTERNALSYM DIMOFS_BUTTON5}
  1970.   DIMOFS_BUTTON6  = DIMOFS_BUTTON0 + 6; // (FIELD_OFFSET(DIMOUSESTATE2, rgbButtons) + 6)
  1971.   {$EXTERNALSYM DIMOFS_BUTTON6}