DirectInput.pas
上传用户:ctlcnc
上传日期:2021-12-10
资源大小:4933k
文件大小:319k
源码类别:

2D图形编程

开发平台:

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