source: Include/directx9/dinput.sbp@ 70

Last change on this file since 70 was 1, checked in by (none), 18 years ago
File size: 31.4 KB
Line 
1' dinput.sbp
2
3
4#ifndef _INC_DINPUT
5#define _INC_DINPUT
6
7
8'----------------
9' Version
10'----------------
11
12Const DIRECTINPUT_VERSION = &H0800
13
14
15'----------------
16' Interfaces
17'----------------
18
19Dim IID_IDirectInput8 = [&HBF798030,&H483A,&H4DA2,[&HAA,&H99,&H5D,&H64,&HED,&H36,&H97,&H00]] As GUID
20Dim IID_IDirectInputDevice8 = [&H54D41080,&HDC15,&H4833,[&HA4,&H1B,&H74,&H8F,&H73,&HA3,&H81,&H79]] As GUID
21Dim IID_IDirectInputEffect = [&HE7E1F7C0,&H88D2,&H11D0,[&H9A,&HD0,&H00,&HA0,&HC9,&HA0,&H6E,&H35]] As GUID
22
23
24'-------------------------
25' Predefined object types
26'-------------------------
27
28Dim GUID_XAxis = [&HA36D02E0,&HC9F3,&H11CF,[&HBF,&HC7,&H44,&H45,&H53,&H54,&H00,&H00]] As GUID
29Dim GUID_YAxis = [&HA36D02E1,&HC9F3,&H11CF,[&HBF,&HC7,&H44,&H45,&H53,&H54,&H00,&H00]] As GUID
30Dim GUID_ZAxis = [&HA36D02E2,&HC9F3,&H11CF,[&HBF,&HC7,&H44,&H45,&H53,&H54,&H00,&H00]] As GUID
31Dim GUID_RxAxis = [&HA36D02F4,&HC9F3,&H11CF,[&HBF,&HC7,&H44,&H45,&H53,&H54,&H00,&H00]] As GUID
32Dim GUID_RyAxis = [&HA36D02F5,&HC9F3,&H11CF,[&HBF,&HC7,&H44,&H45,&H53,&H54,&H00,&H00]] As GUID
33Dim GUID_RzAxis = [&HA36D02E3,&HC9F3,&H11CF,[&HBF,&HC7,&H44,&H45,&H53,&H54,&H00,&H00]] As GUID
34Dim GUID_Slider = [&HA36D02E4,&HC9F3,&H11CF,[&HBF,&HC7,&H44,&H45,&H53,&H54,&H00,&H00]] As GUID
35Dim GUID_Button = [&HA36D02F0,&HC9F3,&H11CF,[&HBF,&HC7,&H44,&H45,&H53,&H54,&H00,&H00]] As GUID
36Dim GUID_Key = [&H55728220,&HD33C,&H11CF,[&HBF,&HC7,&H44,&H45,&H53,&H54,&H00,&H00]] As GUID
37Dim GUID_POV = [&HA36D02F2,&HC9F3,&H11CF,[&HBF,&HC7,&H44,&H45,&H53,&H54,&H00,&H00]] As GUID
38Dim GUID_Unknown = [&HA36D02F3,&HC9F3,&H11CF,[&HBF,&HC7,&H44,&H45,&H53,&H54,&H00,&H00]] As GUID
39
40
41'--------------------------
42' Predefined product GUIDs
43'--------------------------
44
45Dim GUID_SysMouse = [&H6F1D2B60,&HD5A0,&H11CF,[&HBF,&HC7,&H44,&H45,&H53,&H54,&H00,&H00]] As GUID
46Dim GUID_SysKeyboard = [&H6F1D2B61,&HD5A0,&H11CF,[&HBF,&HC7,&H44,&H45,&H53,&H54,&H00,&H00]] As GUID
47Dim GUID_Joystick = [&H6F1D2B70,&HD5A0,&H11CF,[&HBF,&HC7,&H44,&H45,&H53,&H54,&H00,&H00]] As GUID
48Dim GUID_SysMouseEm = [&H6F1D2B80,&HD5A0,&H11CF,[&HBF,&HC7,&H44,&H45,&H53,&H54,&H00,&H00]] As GUID
49Dim GUID_SysMouseEm2 = [&H6F1D2B81,&HD5A0,&H11CF,[&HBF,&HC7,&H44,&H45,&H53,&H54,&H00,&H00]] As GUID
50Dim GUID_SysKeyboardEm = [&H6F1D2B82,&HD5A0,&H11CF,[&HBF,&HC7,&H44,&H45,&H53,&H54,&H00,&H00]] As GUID
51Dim GUID_SysKeyboardEm2 = [&H6F1D2B83,&HD5A0,&H11CF,[&HBF,&HC7,&H44,&H45,&H53,&H54,&H00,&H00]] As GUID
52
53
54Type DIENVELOPE
55 dwSize As DWord
56 dwAttackLevel As DWord
57 dwAttackTime As DWord
58 dwFadeLevel As DWord
59 dwFadeTime As DWord
60End Type
61TypeDef LPDIENVELOPE = *DIENVELOPE
62
63
64Type DIEFFECT
65 dwSize As DWord
66 dwFlags As DWord
67 dwDuration As DWord
68 dwSamplePeriod As DWord
69 dwGain As DWord
70 dwTriggerButton As DWord
71 dwTriggerRepeatInterval As DWord
72 cAxes As DWord
73 rgdwAxes As *DWord
74 rglDirection As *Long
75 lpEnvelope As LPDIENVELOPE
76 cbTypeSpecificParams As DWord
77 lpvTypeSpecificParams As VoidPtr
78 dwStartDelay As DWord
79End Type
80TypeDef LPDIEFFECT = *DIEFFECT
81
82
83Type DIFILEEFFECT
84 dwSize As DWord
85 GuidEffect As GUID
86 lpDiEffect As LPDIEFFECT
87 szFriendlyName[MAX_PATH-1] As Char
88End Type
89TypeDef LPDIFILEEFFECT = *DIFILEEFFECT
90
91
92Type DIEFFESCAPE
93 dwSize As DWord
94 dwCommand As DWord
95 lpvInBuffer As VoidPtr
96 cbInBuffer As DWord
97 lpvOutBuffer As VoidPtr
98 cbOutBuffer As DWord
99End Type
100TypeDef LPDIEFFESCAPE = *DIEFFESCAPE
101
102
103Class IDirectInputEffect
104 Inherits IUnknown
105Public
106 'IDirectInputEffect methods
107 Abstract Function Initialize(hinst As HINSTANCE, dwVersion As DWord, ByRef rguid As GUID) As DWord
108 Abstract Function GetEffectGuid(pguid As *GUID) As DWord
109 Abstract Function GetParameters(peff As LPDIEFFECT, dwFlags As DWord) As DWord
110 Abstract Function SetParameters(peff As LPDIEFFECT, dwFlags As DWord) As DWord
111 Abstract Function Start(dwIterations As DWord, dwFlags As DWord) As DWord
112 Abstract Function Stop() As DWord
113 Abstract Function GetEffectStatus(pdwFlags As *DWord) As DWord
114 Abstract Function Download() As DWord
115 Abstract Function Unload() As DWord
116 Abstract Function Escape(pesc As LPDIEFFESCAPE) As DWord
117End Class
118TypeDef LPDIRECTINPUTEFFECT = *IDirectInputEffect
119
120
121Type DIDEVCAPS
122 dwSize As DWord
123 dwFlags As DWord
124 dwDevType As DWord
125 dwAxes As DWord
126 dwButtons As DWord
127 dwPOVs As DWord
128 dwFFSamplePeriod As DWord
129 dwFFMinTimeResolution As DWord
130 dwFirmwareRevision As DWord
131 dwHardwareRevision As DWord
132 dwFFDriverVersion As DWord
133End Type
134TypeDef LPDIDEVCAPS = *DIDEVCAPS
135
136
137Const DIDOI_FFACTUATOR = &H00000001
138Const DIDOI_FFEFFECTTRIGGER = &H00000002
139Const DIDOI_POLLED = &H00008000
140Const DIDOI_ASPECTPOSITION = &H00000100
141Const DIDOI_ASPECTVELOCITY = &H00000200
142Const DIDOI_ASPECTACCEL = &H00000300
143Const DIDOI_ASPECTFORCE = &H00000400
144Const DIDOI_ASPECTMASK = &H00000F00
145Const DIDOI_GUIDISUSAGE = &H00010000
146Type DIOBJECTDATAFORMAT
147 pguid As *GUID
148 dwOfs As DWord
149 dwType As DWord
150 dwFlags As DWord
151End Type
152TypeDef LPDIOBJECTDATAFORMAT = *DIOBJECTDATAFORMAT
153
154
155Const DIDFT_ALL = &H00000000
156Const DIDFT_RELAXIS = &H00000001
157Const DIDFT_ABSAXIS = &H00000002
158Const DIDFT_AXIS = &H00000003
159Const DIDFT_PSHBUTTON = &H00000004
160Const DIDFT_TGLBUTTON = &H00000008
161Const DIDFT_BUTTON = &H0000000C
162Const DIDFT_POV = &H00000010
163Const DIDFT_COLLECTION = &H00000040
164Const DIDFT_NODATA = &H00000080
165Const DIDFT_ANYINSTANCE = &H00FFFF00
166Const DIDFT_INSTANCEMASK = DIDFT_ANYINSTANCE
167Const DIDFT_FFACTUATOR = &H01000000
168Const DIDFT_FFEFFECTTRIGGER = &H02000000
169Const DIDFT_OUTPUT = &H10000000
170Const DIDFT_VENDORDEFINED = &H04000000
171Const DIDFT_ALIAS = &H08000000
172Const DIDFT_OPTIONAL = &H80000000
173Const DIDFT_NOCOLLECTION = &H00FFFF00
174Type DIDATAFORMAT
175 dwSize As DWord
176 dwObjSize As DWord
177 dwFlags As DWord
178 dwDataSize As DWord
179 dwNumObjs As DWord
180 rgodf As LPDIOBJECTDATAFORMAT
181End Type
182TypeDef LPDIDATAFORMAT = *DIDATAFORMAT
183
184Const DIDF_ABSAXIS = &H00000001
185Const DIDF_RELAXIS = &H00000002
186
187
188Type DIACTION
189 uAppData As DWord
190 dwSemantic As DWord
191 dwFlags As DWord
192 lptszActionName As *Char
193 guidInstance As GUID
194 dwObjID As DWord
195 dwHow As DWord
196End Type
197TypeDef LPDIACTION = *DIACTION
198
199
200Type DIACTIONFORMAT
201 dwSize As DWord
202 dwActionSize As DWord
203 dwDataSize As DWord
204 dwNumActions As DWord
205 rgoAction As LPDIACTION
206 guidActionMap As GUID
207 dwGenre As DWord
208 dwBufferSize As DWord
209 lAxisMin As Long
210 lAxisMax As Long
211 hInstString As HINSTANCE
212 ftTimeStamp As FILETIME
213 dwCRC As DWord
214 tszActionMap[MAX_PATH-1] As Char
215End Type
216TypeDef LPDIACTIONFORMAT = *DIACTIONFORMAT
217
218
219Type DICOLORSET
220 dwSize As DWord
221 cTextFore As D3DCOLOR
222 cTextHighlight As D3DCOLOR
223 cCalloutLine As D3DCOLOR
224 cCalloutHighlight As D3DCOLOR
225 cBorder As D3DCOLOR
226 cControlFill As D3DCOLOR
227 cHighlightFill As D3DCOLOR
228 cAreaFill As D3DCOLOR
229End Type
230
231
232Type DICONFIGUREDEVICESPARAMS
233 dwSize As DWord
234 dwcUsers As DWord
235 lptszUserNames As *Char
236 dwcFormats As DWord
237 lprgFormats As LPDIACTIONFORMAT
238 hwnd As HWND
239 dics As DICOLORSET
240 lpUnkDDSTarget As *IUnknown
241End Type
242TypeDef LPDICONFIGUREDEVICESPARAMS = *DICONFIGUREDEVICESPARAMS
243
244
245Type DIDEVICEIMAGEINFO
246 tszImagePath[MAX_PATH-1] As Char
247 dwFlags As DWord
248 dwViewID As DWord
249 rcOverlay As RECT
250 dwObjID As DWord
251 dwcValidPts As DWord
252 rgptCalloutLine[5-1] As POINTAPI
253 rcCalloutRect As RECT
254 dwTextAlign As DWord
255End Type
256TypeDef LPDIDEVICEIMAGEINFO = *DIDEVICEIMAGEINFO
257
258
259Type DIDEVICEIMAGEINFOHEADER
260 dwSize As DWord
261 dwSizeImageInfo As DWord
262 dwcViews As DWord
263 dwcButtons As DWord
264 dwcAxes As DWord
265 dwcPOVs As DWord
266 dwBufferSize As DWord
267 dwBufferUsed As DWord
268 lprgImageInfoArray As LPDIDEVICEIMAGEINFO
269End Type
270TypeDef LPDIDEVICEIMAGEINFOHEADER = *DIDEVICEIMAGEINFOHEADER
271
272
273Type DIDEVICEOBJECTINSTANCE
274 dwSize As DWord
275 guidType As GUID
276 dwOfs As DWord
277 dwType As DWord
278 dwFlags As DWord
279 tszName[MAX_PATH-1] As Char
280 dwFFMaxForce As DWord
281 dwFFForceResolution As DWord
282 wCollectionNumber As Word
283 wDesignatorIndex As Word
284 wUsagePage As Word
285 wUsage As Word
286 dwDimension As DWord
287 wExponent As Word
288 wReportId As Word
289End Type
290TypeDef LPDIDEVICEOBJECTINSTANCE = *DIDEVICEOBJECTINSTANCE
291
292
293Type DIPROPHEADER
294 dwSize As DWord
295 dwHeaderSize As DWord
296 dwObj As DWord
297 dwHow As DWord
298End Type
299TypeDef LPDIPROPHEADER = *DIPROPHEADER
300
301
302Type DIDEVICEOBJECTDATA
303 dwOfs As DWord
304 dwData As DWord
305 dwTimeStamp As DWord
306 dwSequence As DWord
307 uAppData As DWord
308End Type
309TypeDef LPDIDEVICEOBJECTDATA = *DIDEVICEOBJECTDATA
310
311
312Const DISCL_EXCLUSIVE = &H00000001
313Const DISCL_NONEXCLUSIVE = &H00000002
314Const DISCL_FOREGROUND = &H00000004
315Const DISCL_BACKGROUND = &H00000008
316Const DISCL_NOWINKEY = &H00000010
317
318
319Type DIDEVICEINSTANCE
320 dwSize As DWord
321 guidInstance As GUID
322 guidProduct As GUID
323 dwDevType As DWord
324 tszInstanceName[MAX_PATH-1] As Char
325 tszProductName[MAX_PATH-1] As Char
326 guidFFDriver As GUID
327 wUsagePage As Word
328 wUsage As Word
329End Type
330TypeDef LPDIDEVICEINSTANCE = *DIDEVICEINSTANCE
331
332
333Type DIEFFECTINFO
334 dwSize As DWord
335 guid As GUID
336 dwEffType As DWord
337 dwStaticParams As DWord
338 dwDynamicParams As DWord
339 tszName[MAX_PATH-1] As Char
340End Type
341TypeDef LPDIEFFECTINFO = *DIEFFECTINFO
342
343
344Class IDirectInputDevice8
345 Inherits IUnknown
346Public
347 'IDirectInputDevice8 methods
348 Abstract Function GetCapabilities(lpDIDevCaps As LPDIDEVCAPS) As DWord
349 Abstract Function EnumObjects(lpCallback As VoidPtr, pvRef As VoidPtr, dwFlags As DWord) As DWord
350 Abstract Function GetProperty(ByRef rguidProp As GUID, pdiph As LPDIPROPHEADER) As DWord
351 Abstract Function SetProperty(ByRef rguidProp As GUID, pdiph As LPDIPROPHEADER) As DWord
352 Abstract Function Acquire() As DWord
353 Abstract Function Unacquire() As DWord
354 Abstract Function GetDeviceState(cbData As DWord, lpvData As VoidPtr) As DWord
355 Abstract Function GetDeviceData(cbObjectData As DWord, rgdod As LPDIDEVICEOBJECTDATA, pdwInOut As *DWord, dwFlags As DWord) As DWord
356 Abstract Function SetDataFormat(lpdf As LPDIDATAFORMAT) As DWord
357 Abstract Function SetEventNotification(hEvent As HANDLE) As DWord
358 Abstract Function SetCooperativeLevel(hwnd As HWND, dwFlags As DWord) As DWord
359 Abstract Function GetObjectInfo(pdidoi As LPDIDEVICEOBJECTINSTANCE, dwObj As DWord, dwHow As DWord) As DWord
360 Abstract Function GetDeviceInfo(pdidi As LPDIDEVICEINSTANCE) As DWord
361 Abstract Function RunControlPanel(hwndOwner As HWND, dwFlags As DWord) As DWord
362 Abstract Function Initialize(hinst As HINSTANCE, dwVersion As DWord, ByRef rguid As GUID) As DWord
363 Abstract Function CreateEffect(ByRef rguid As GUID, lpeff As LPDIEFFECT, ppdeff As *LPDIRECTINPUTEFFECT, punkOuter As LPUNKNOWN) As DWord
364 Abstract Function EnumEffects(lpCallback As VoidPtr, pvRef As VoidPtr, dwEffType As DWord) As DWord
365 Abstract Function GetEffectInfo(pdei As LPDIEFFECTINFO, ByRef rguid As GUID) As DWord
366 Abstract Function GetForceFeedbackState(pdwOut As *DWord) As DWord
367 Abstract Function SendForceFeedbackCommand(dwFlags As DWord) As DWord
368 Abstract Function EnumCreatedEffectObjects(lpCallback As VoidPtr, pvRef As VoidPtr, fl As DWord) As DWord
369 Abstract Function Escape(pesc As LPDIEFFESCAPE) As DWord
370 Abstract Function Poll() As DWord
371 Abstract Function SendDeviceData(cbObjectData As DWord, rgdod As LPDIDEVICEOBJECTDATA, pdwInOut As *DWord, fl As DWord) As DWord
372 Abstract Function EnumEffectsInFile(lpszFileName As *Char, pec As VoidPtr, pvRef As VoidPtr, dwFlags As DWord) As DWord
373 Abstract Function WriteEffectToFile(lpszFileName As *Char, dwEntries As DWord, rgDiFileEft As LPDIFILEEFFECT, dwFlags As DWord) As DWord
374 Abstract Function BuildActionMap(lpdiaf As LPDIACTIONFORMAT, lpszUserName As *Char, dwFlags As DWord) As DWord
375 Abstract Function SetActionMap(lpdiActionFormat As LPDIACTIONFORMAT, lptszUserName As *Char, dwFlags As DWord) As DWord
376 Abstract Function GetImageInfo(lpdiDevImageInfoHeader As LPDIDEVICEIMAGEINFOHEADER) As DWord
377End Class
378TypeDef LPDIRECTINPUTDEVICE8 = *IDirectInputDevice8
379
380
381Class IDirectInput8
382 Inherits IUnknown
383Public
384 'IDirectInput8 methods
385 Abstract Function CreateDevice(ByRef rguid As GUID, lplpDirectInputDevice As *LPDIRECTINPUTDEVICE8, pUnkOuter As LPUNKNOWN) As DWord
386 Abstract Function EnumDevices(dwDevType As DWord, lpCallback As VoidPtr, pvRef As VoidPtr, dwFlags As DWord) As DWord
387 Abstract Function GetDeviceStatus(ByRef rguidInstance As GUID) As DWord
388 Abstract Function RunControlPanel(hwndOwner As HWND, dwFlags As DWord) As DWord
389 Abstract Function Initialize(hinst As HINSTANCE, dwVersion As DWord) As DWord
390 Abstract Function FindDevice(ByRef rguidClass As GUID, ptszName As *Char, pguidInstance As *GUID) As DWord
391 Abstract Function EnumDevicesBySemantics(ptszUserName As *Char, lpdiActionFormat As LPDIACTIONFORMAT, lpCallback As VoidPtr, pvRef As VoidPtr, dwFlags As DWord) As DWord
392 Abstract Function ConfigureDevices(lpdiCallback As VoidPtr, lpdiCDParams As LPDICONFIGUREDEVICESPARAMS, dwFlags As DWord, pvRefData As VoidPtr) As DWord
393End Class
394TypeDef LPDIRECTINPUT8 = *IDirectInput8
395
396
397'---------------------------------
398' DirectInput keyboard scan codes
399'---------------------------------
400
401Const DIK_ESCAPE = &H01
402Const DIK_1 = &H02
403Const DIK_2 = &H03
404Const DIK_3 = &H04
405Const DIK_4 = &H05
406Const DIK_5 = &H06
407Const DIK_6 = &H07
408Const DIK_7 = &H08
409Const DIK_8 = &H09
410Const DIK_9 = &H0A
411Const DIK_0 = &H0B
412Const DIK_MINUS = &H0C '- on main keyboard
413Const DIK_EQUALS = &H0D
414Const DIK_BACK = &H0E 'backspace
415Const DIK_TAB = &H0F
416Const DIK_Q = &H10
417Const DIK_W = &H11
418Const DIK_E = &H12
419Const DIK_R = &H13
420Const DIK_T = &H14
421Const DIK_Y = &H15
422Const DIK_U = &H16
423Const DIK_I = &H17
424Const DIK_O = &H18
425Const DIK_P = &H19
426Const DIK_LBRACKET = &H1A
427Const DIK_RBRACKET = &H1B
428Const DIK_RETURN = &H1C 'Enter on main keyboard
429Const DIK_LCONTROL = &H1D
430Const DIK_A = &H1E
431Const DIK_S = &H1F
432Const DIK_D = &H20
433Const DIK_F = &H21
434Const DIK_G = &H22
435Const DIK_H = &H23
436Const DIK_J = &H24
437Const DIK_K = &H25
438Const DIK_L = &H26
439Const DIK_SEMICOLON = &H27
440Const DIK_APOSTROPHE = &H28
441Const DIK_GRAVE = &H29 'accent grave
442Const DIK_LSHIFT = &H2A
443Const DIK_BACKSLASH = &H2B
444Const DIK_Z = &H2C
445Const DIK_X = &H2D
446Const DIK_C = &H2E
447Const DIK_V = &H2F
448Const DIK_B = &H30
449Const DIK_N = &H31
450Const DIK_M = &H32
451Const DIK_COMMA = &H33
452Const DIK_PERIOD = &H34 '. on main keyboard
453Const DIK_SLASH = &H35 '/ on main keyboard
454Const DIK_RSHIFT = &H36
455Const DIK_MULTIPLY = &H37 '* on numeric keypad
456Const DIK_LMENU = &H38 'left Alt
457Const DIK_SPACE = &H39
458Const DIK_CAPITAL = &H3A
459Const DIK_F1 = &H3B
460Const DIK_F2 = &H3C
461Const DIK_F3 = &H3D
462Const DIK_F4 = &H3E
463Const DIK_F5 = &H3F
464Const DIK_F6 = &H40
465Const DIK_F7 = &H41
466Const DIK_F8 = &H42
467Const DIK_F9 = &H43
468Const DIK_F10 = &H44
469Const DIK_NUMLOCK = &H45
470Const DIK_SCROLL = &H46 'Scroll Lock
471Const DIK_NUMPAD7 = &H47
472Const DIK_NUMPAD8 = &H48
473Const DIK_NUMPAD9 = &H49
474Const DIK_SUBTRACT = &H4A '- on numeric keypad
475Const DIK_NUMPAD4 = &H4B
476Const DIK_NUMPAD5 = &H4C
477Const DIK_NUMPAD6 = &H4D
478Const DIK_ADD = &H4E '+ on numeric keypad
479Const DIK_NUMPAD1 = &H4F
480Const DIK_NUMPAD2 = &H50
481Const DIK_NUMPAD3 = &H51
482Const DIK_NUMPAD0 = &H52
483Const DIK_DECIMAL = &H53 '. on numeric keypad
484Const DIK_OEM_102 = &H56 '<> or \| on RT 102-key keyboard (Non-U.S.)
485Const DIK_F11 = &H57
486Const DIK_F12 = &H58
487Const DIK_F13 = &H64 ' (NEC PC98)
488Const DIK_F14 = &H65 ' (NEC PC98)
489Const DIK_F15 = &H66 ' (NEC PC98)
490Const DIK_KANA = &H70 '(Japanese keyboard)
491Const DIK_ABNT_C1 = &H73 '/? on Brazilian keyboard
492Const DIK_CONVERT = &H79 '(Japanese keyboard)
493Const DIK_NOCONVERT = &H7B '(Japanese keyboard)
494Const DIK_YEN = &H7D '(Japanese keyboard)
495Const DIK_ABNT_C2 = &H7E 'Numpad . on Brazilian keyboard
496Const DIK_NUMPADEQUALS = &H8D '= on numeric keypad (NEC PC98)
497Const DIK_PREVTRACK = &H90 'Previous Track (DIK_CIRCUMFLEX on Japanese keyboard)
498Const DIK_AT = &H91 ' (NEC PC98)
499Const DIK_COLON = &H92 ' (NEC PC98)
500Const DIK_UNDERLINE = &H93 ' (NEC PC98)
501Const DIK_KANJI = &H94 '(Japanese keyboard)
502Const DIK_STOP = &H95 ' (NEC PC98)
503Const DIK_AX = &H96 ' (Japan AX)
504Const DIK_UNLABELED = &H97 ' (J3100)
505Const DIK_NEXTTRACK = &H99 'Next Track
506Const DIK_NUMPADENTER = &H9C 'Enter on numeric keypad
507Const DIK_RCONTROL = &H9D
508Const DIK_MUTE = &HA0 'Mute
509Const DIK_CALCULATOR = &HA1 'Calculator
510Const DIK_PLAYPAUSE = &HA2 'Play / Pause
511Const DIK_MEDIASTOP = &HA4 'Media Stop
512Const DIK_VOLUMEDOWN = &HAE 'Volume -
513Const DIK_VOLUMEUP = &HB0 'Volume +
514Const DIK_WEBHOME = &HB2 'Web home
515Const DIK_NUMPADCOMMA = &HB3 ', on numeric keypad (NEC PC98)
516Const DIK_DIVIDE = &HB5 '/ on numeric keypad
517Const DIK_SYSRQ = &HB7
518Const DIK_RMENU = &HB8 'right Alt
519Const DIK_PAUSE = &HC5 'Pause
520Const DIK_HOME = &HC7 'Home on arrow keypad
521Const DIK_UP = &HC8 'UpArrow on arrow keypad
522Const DIK_PRIOR = &HC9 'PgUp on arrow keypad
523Const DIK_LEFT = &HCB 'LeftArrow on arrow keypad
524Const DIK_RIGHT = &HCD 'RightArrow on arrow keypad
525Const DIK_END = &HCF 'End on arrow keypad
526Const DIK_DOWN = &HD0 'DownArrow on arrow keypad
527Const DIK_NEXT = &HD1 'PgDn on arrow keypad
528Const DIK_INSERT = &HD2 'Insert on arrow keypad
529Const DIK_DELETE = &HD3 'Delete on arrow keypad
530Const DIK_LWIN = &HDB 'Left Windows key
531Const DIK_RWIN = &HDC 'Right Windows key
532Const DIK_APPS = &HDD 'AppMenu key
533Const DIK_POWER = &HDE 'System Power
534Const DIK_SLEEP = &HDF 'System Sleep
535Const DIK_WAKE = &HE3 'System Wake
536Const DIK_WEBSEARCH = &HE5 'Web Search
537Const DIK_WEBFAVORITES = &HE6 'Web Favorites
538Const DIK_WEBREFRESH = &HE7 'Web Refresh
539Const DIK_WEBSTOP = &HE8 'Web Stop
540Const DIK_WEBFORWARD = &HE9 'Web Forward
541Const DIK_WEBBACK = &HEA 'Web Back
542Const DIK_MYCOMPUTER = &HEB 'My Computer
543Const DIK_MAIL = &HEC 'Mail
544Const DIK_MEDIASELECT = &HED 'Media Select
545
546' Alternate names for keys, to facilitate transition from DOS.
547Const DIK_BACKSPACE = DIK_BACK 'backspace
548Const DIK_NUMPADSTAR = DIK_MULTIPLY '* on numeric keypad
549Const DIK_LALT = DIK_LMENU 'left Alt
550Const DIK_CAPSLOCK = DIK_CAPITAL 'CapsLock
551Const DIK_NUMPADMINUS = DIK_SUBTRACT '- on numeric keypad
552Const DIK_NUMPADPLUS = DIK_ADD '+ on numeric keypad
553Const DIK_NUMPADPERIOD = DIK_DECIMAL '. on numeric keypad
554Const DIK_NUMPADSLASH = DIK_DIVIDE '/ on numeric keypad
555Const DIK_RALT = DIK_RMENU 'right Alt
556Const DIK_UPARROW = DIK_UP 'UpArrow on arrow keypad
557Const DIK_PGUP = DIK_PRIOR 'PgUp on arrow keypad
558Const DIK_LEFTARROW = DIK_LEFT 'LeftArrow on arrow keypad
559Const DIK_RIGHTARROW = DIK_RIGHT 'RightArrow on arrow keypad
560Const DIK_DOWNARROW = DIK_DOWN 'DownArrow on arrow keypad
561Const DIK_PGDN = DIK_NEXT 'PgDn on arrow keypad
562
563' Alternate names for keys originally not used on US keyboards.
564Const DIK_CIRCUMFLEX = DIK_PREVTRACK 'Japanese keyboard
565
566
567'-----------------------
568' Mouse
569'-----------------------
570
571Type DIMOUSESTATE
572 lX As Long
573 lY As Long
574 lZ As Long
575 rgbButtons[3] As Byte
576End Type
577
578Type DIMOUSESTATE2
579 lX As Long
580 lY As Long
581 lZ As Long
582 rgbButtons[7] As Byte
583End Type
584
585
586Declare Function DirectInput8Create Lib "dinput8" (hinst As HINSTANCE, dwVersion As DWord, ByRef riidltf As GUID, ppvOut As *DWord, punkOuter As *IUnknown) As DWord
587
588
589'-------------------
590' Device Data Type
591'-------------------
592
593'c_dfDIKeyboard
594Sub _System_DirectInput_Keyboard_SetDataType(p As *DIOBJECTDATAFORMAT)
595 Dim i As Long
596 For i=0 To 255
597 p[i].pguid=VarPtr(GUID_Key)
598 p[i].dwOfs=i
599 p[i].dwType=DIDFT_BUTTON or DIDFT_OPTIONAL or (i<<8)
600 p[i].dwFlags=0
601 Next
602End Sub
603Dim _System_dfDIKeyboardObjectDataFormat[255] As DIOBJECTDATAFORMAT
604_System_DirectInput_Keyboard_SetDataType(_System_dfDIKeyboardObjectDataFormat)
605Dim c_dfDIKeyboard=[24,16,DIDF_RELAXIS,256,256,0] As DIDATAFORMAT
606c_dfDIKeyboard.rgodf=_System_dfDIKeyboardObjectDataFormat
607
608'c_dfDIMouse
609Dim _System_dfDIMouseObjectDataFormat[6]=[
610 [0,&H00,DIDFT_ANYINSTANCE or DIDFT_AXIS,0],
611 [0,&H04,DIDFT_ANYINSTANCE or DIDFT_AXIS,0],
612 [0,&H08,DIDFT_ANYINSTANCE or DIDFT_AXIS or DIDFT_OPTIONAL,0],
613 [0,&H0C,DIDFT_ANYINSTANCE or DIDFT_BUTTON,0],
614 [0,&H0D,DIDFT_ANYINSTANCE or DIDFT_BUTTON,0],
615 [0,&H0E,DIDFT_ANYINSTANCE or DIDFT_BUTTON or DIDFT_OPTIONAL,0],
616 [0,&H0F,DIDFT_ANYINSTANCE or DIDFT_BUTTON or DIDFT_OPTIONAL,0]
617] As DIOBJECTDATAFORMAT
618_System_dfDIMouseObjectDataFormat[0].pguid=VarPtr(GUID_XAxis)
619_System_dfDIMouseObjectDataFormat[1].pguid=VarPtr(GUID_YAxis)
620_System_dfDIMouseObjectDataFormat[2].pguid=VarPtr(GUID_ZAxis)
621Dim c_dfDIMouse=[24,16,DIDF_RELAXIS,16,7,0] As DIDATAFORMAT
622c_dfDIMouse.rgodf=_System_dfDIMouseObjectDataFormat
623
624'c_dfDIMouse2
625Dim _System_dfDIMouse2ObjectDataFormat[10]=[
626 [0,&H00,DIDFT_ANYINSTANCE or DIDFT_AXIS,0],
627 [0,&H04,DIDFT_ANYINSTANCE or DIDFT_AXIS,0],
628 [0,&H08,DIDFT_ANYINSTANCE or DIDFT_AXIS or DIDFT_OPTIONAL,0],
629 [0,&H0C,DIDFT_ANYINSTANCE or DIDFT_BUTTON,0],
630 [0,&H0D,DIDFT_ANYINSTANCE or DIDFT_BUTTON,0],
631 [0,&H0E,DIDFT_ANYINSTANCE or DIDFT_BUTTON or DIDFT_OPTIONAL,0],
632 [0,&H0F,DIDFT_ANYINSTANCE or DIDFT_BUTTON or DIDFT_OPTIONAL,0],
633 [0,&H10,DIDFT_ANYINSTANCE or DIDFT_BUTTON or DIDFT_OPTIONAL,0],
634 [0,&H11,DIDFT_ANYINSTANCE or DIDFT_BUTTON or DIDFT_OPTIONAL,0],
635 [0,&H12,DIDFT_ANYINSTANCE or DIDFT_BUTTON or DIDFT_OPTIONAL,0],
636 [0,&H13,DIDFT_ANYINSTANCE or DIDFT_BUTTON or DIDFT_OPTIONAL,0]
637] As DIOBJECTDATAFORMAT
638_System_dfDIMouse2ObjectDataFormat[0].pguid=VarPtr(GUID_XAxis)
639_System_dfDIMouse2ObjectDataFormat[1].pguid=VarPtr(GUID_YAxis)
640_System_dfDIMouse2ObjectDataFormat[2].pguid=VarPtr(GUID_ZAxis)
641Dim c_dfDIMouse2=[24,16,DIDF_RELAXIS,20,11,0] As DIDATAFORMAT
642c_dfDIMouse2.rgodf=_System_dfDIMouse2ObjectDataFormat
643
644'c_dfDIJoystick
645Sub _System_DirectInput_Joystick_SetDataType(p As *DIOBJECTDATAFORMAT)
646 Dim i As Long
647 For i=12 To &H2B
648 p[i].pguid=0
649 p[i].dwOfs=&H30+i-12
650 p[i].dwType=DIDFT_ANYINSTANCE or DIDFT_BUTTON or DIDFT_OPTIONAL or (i<<8)
651 p[i].dwFlags=0
652 Next
653End Sub
654Dim _System_dfDIJoystickObjectDataFormat[&H2B]=[
655 [0,&H00,DIDFT_ANYINSTANCE or DIDFT_AXIS or DIDFT_OPTIONAL,DIDOI_ASPECTPOSITION],
656 [0,&H04,DIDFT_ANYINSTANCE or DIDFT_AXIS or DIDFT_OPTIONAL,DIDOI_ASPECTPOSITION],
657 [0,&H08,DIDFT_ANYINSTANCE or DIDFT_AXIS or DIDFT_OPTIONAL,DIDOI_ASPECTPOSITION],
658 [0,&H0C,DIDFT_ANYINSTANCE or DIDFT_AXIS or DIDFT_OPTIONAL,DIDOI_ASPECTPOSITION],
659 [0,&H10,DIDFT_ANYINSTANCE or DIDFT_AXIS or DIDFT_OPTIONAL,DIDOI_ASPECTPOSITION],
660 [0,&H14,DIDFT_ANYINSTANCE or DIDFT_AXIS or DIDFT_OPTIONAL,DIDOI_ASPECTPOSITION],
661 [0,&H18,DIDFT_ANYINSTANCE or DIDFT_AXIS or DIDFT_OPTIONAL,DIDOI_ASPECTPOSITION],
662 [0,&H1C,DIDFT_ANYINSTANCE or DIDFT_AXIS or DIDFT_OPTIONAL,DIDOI_ASPECTPOSITION],
663 [0,&H20,DIDFT_ANYINSTANCE or DIDFT_POV or DIDFT_OPTIONAL,0],
664 [0,&H24,DIDFT_ANYINSTANCE or DIDFT_POV or DIDFT_OPTIONAL,0],
665 [0,&H28,DIDFT_ANYINSTANCE or DIDFT_POV or DIDFT_OPTIONAL,0],
666 [0,&H2C,DIDFT_ANYINSTANCE or DIDFT_POV or DIDFT_OPTIONAL,0]
667] As DIOBJECTDATAFORMAT
668_System_dfDIJoystickObjectDataFormat[0].pguid=VarPtr(GUID_XAxis)
669_System_dfDIJoystickObjectDataFormat[1].pguid=VarPtr(GUID_YAxis)
670_System_dfDIJoystickObjectDataFormat[2].pguid=VarPtr(GUID_ZAxis)
671_System_dfDIJoystickObjectDataFormat[3].pguid=VarPtr(GUID_RxAxis)
672_System_dfDIJoystickObjectDataFormat[4].pguid=VarPtr(GUID_RyAxis)
673_System_dfDIJoystickObjectDataFormat[5].pguid=VarPtr(GUID_RzAxis)
674_System_dfDIJoystickObjectDataFormat[6].pguid=VarPtr(GUID_Slider)
675_System_dfDIJoystickObjectDataFormat[7].pguid=VarPtr(GUID_Slider)
676_System_dfDIJoystickObjectDataFormat[8].pguid=VarPtr(GUID_POV)
677_System_dfDIJoystickObjectDataFormat[9].pguid=VarPtr(GUID_POV)
678_System_dfDIJoystickObjectDataFormat[10].pguid=VarPtr(GUID_POV)
679_System_dfDIJoystickObjectDataFormat[11].pguid=VarPtr(GUID_POV)
680_System_DirectInput_Joystick_SetDataType(_System_dfDIJoystickObjectDataFormat)
681Dim c_dfDIJoystick=[24,16,DIDF_ABSAXIS,&H50,&H2C,0] As DIDATAFORMAT
682c_dfDIJoystick.rgodf=_System_dfDIJoystickObjectDataFormat
683
684'c_dfDIJoystick2
685Sub _System_DirectInput_Joystick2_SetDataType(p As *DIOBJECTDATAFORMAT)
686 Dim i As Long
687 For i=12 To &H8B
688 p[i].pguid=0
689 p[i].dwOfs=&H30+i-12
690 p[i].dwType=DIDFT_ANYINSTANCE or DIDFT_BUTTON or DIDFT_OPTIONAL or (i<<8)
691 p[i].dwFlags=0
692 Next
693
694 With p[&H8C]:.pguid=VarPtr(GUID_XAxis):.dwOfs=&HB0:.dwType=DIDFT_ANYINSTANCE or DIDFT_AXIS or DIDFT_OPTIONAL:.dwFlags=DIDOI_ASPECTVELOCITY:End With
695 With p[&H8D]:.pguid=VarPtr(GUID_YAxis):.dwOfs=&HB4:.dwType=DIDFT_ANYINSTANCE or DIDFT_AXIS or DIDFT_OPTIONAL:.dwFlags=DIDOI_ASPECTVELOCITY:End With
696 With p[&H8E]:.pguid=VarPtr(GUID_ZAxis):.dwOfs=&HB8:.dwType=DIDFT_ANYINSTANCE or DIDFT_AXIS or DIDFT_OPTIONAL:.dwFlags=DIDOI_ASPECTVELOCITY:End With
697 With p[&H8F]:.pguid=VarPtr(GUID_RxAxis):.dwOfs=&HBC:.dwType=DIDFT_ANYINSTANCE or DIDFT_AXIS or DIDFT_OPTIONAL:.dwFlags=DIDOI_ASPECTVELOCITY:End With
698 With p[&H90]:.pguid=VarPtr(GUID_RyAxis):.dwOfs=&HC0:.dwType=DIDFT_ANYINSTANCE or DIDFT_AXIS or DIDFT_OPTIONAL:.dwFlags=DIDOI_ASPECTVELOCITY:End With
699 With p[&H91]:.pguid=VarPtr(GUID_RzAxis):.dwOfs=&HC4:.dwType=DIDFT_ANYINSTANCE or DIDFT_AXIS or DIDFT_OPTIONAL:.dwFlags=DIDOI_ASPECTVELOCITY:End With
700 With p[&H92]:.pguid=VarPtr(GUID_Slider):.dwOfs=&H18:.dwType=DIDFT_ANYINSTANCE or DIDFT_AXIS or DIDFT_OPTIONAL:.dwFlags=DIDOI_ASPECTVELOCITY:End With
701 With p[&H93]:.pguid=VarPtr(GUID_Slider):.dwOfs=&H1C:.dwType=DIDFT_ANYINSTANCE or DIDFT_AXIS or DIDFT_OPTIONAL:.dwFlags=DIDOI_ASPECTVELOCITY:End With
702
703 With p[&H94]:.pguid=VarPtr(GUID_XAxis):.dwOfs=&HD0:.dwType=DIDFT_ANYINSTANCE or DIDFT_AXIS or DIDFT_OPTIONAL:.dwFlags=DIDOI_ASPECTACCEL:End With
704 With p[&H95]:.pguid=VarPtr(GUID_YAxis):.dwOfs=&HD4:.dwType=DIDFT_ANYINSTANCE or DIDFT_AXIS or DIDFT_OPTIONAL:.dwFlags=DIDOI_ASPECTACCEL:End With
705 With p[&H96]:.pguid=VarPtr(GUID_ZAxis):.dwOfs=&HD8:.dwType=DIDFT_ANYINSTANCE or DIDFT_AXIS or DIDFT_OPTIONAL:.dwFlags=DIDOI_ASPECTACCEL:End With
706 With p[&H97]:.pguid=VarPtr(GUID_RxAxis):.dwOfs=&HDC:.dwType=DIDFT_ANYINSTANCE or DIDFT_AXIS or DIDFT_OPTIONAL:.dwFlags=DIDOI_ASPECTACCEL:End With
707 With p[&H98]:.pguid=VarPtr(GUID_RyAxis):.dwOfs=&HE0:.dwType=DIDFT_ANYINSTANCE or DIDFT_AXIS or DIDFT_OPTIONAL:.dwFlags=DIDOI_ASPECTACCEL:End With
708 With p[&H99]:.pguid=VarPtr(GUID_RzAxis):.dwOfs=&HE4:.dwType=DIDFT_ANYINSTANCE or DIDFT_AXIS or DIDFT_OPTIONAL:.dwFlags=DIDOI_ASPECTACCEL:End With
709 With p[&H9A]:.pguid=VarPtr(GUID_Slider):.dwOfs=&H18:.dwType=DIDFT_ANYINSTANCE or DIDFT_AXIS or DIDFT_OPTIONAL:.dwFlags=DIDOI_ASPECTACCEL:End With
710 With p[&H9B]:.pguid=VarPtr(GUID_Slider):.dwOfs=&H1C:.dwType=DIDFT_ANYINSTANCE or DIDFT_AXIS or DIDFT_OPTIONAL:.dwFlags=DIDOI_ASPECTACCEL:End With
711
712 With p[&H9C]:.pguid=VarPtr(GUID_XAxis):.dwOfs=&HF0:.dwType=DIDFT_ANYINSTANCE or DIDFT_AXIS or DIDFT_OPTIONAL:.dwFlags=DIDOI_ASPECTFORCE:End With
713 With p[&H9D]:.pguid=VarPtr(GUID_YAxis):.dwOfs=&HF4:.dwType=DIDFT_ANYINSTANCE or DIDFT_AXIS or DIDFT_OPTIONAL:.dwFlags=DIDOI_ASPECTFORCE:End With
714 With p[&H9E]:.pguid=VarPtr(GUID_ZAxis):.dwOfs=&HF8:.dwType=DIDFT_ANYINSTANCE or DIDFT_AXIS or DIDFT_OPTIONAL:.dwFlags=DIDOI_ASPECTFORCE:End With
715 With p[&H9F]:.pguid=VarPtr(GUID_RxAxis):.dwOfs=&HFC:.dwType=DIDFT_ANYINSTANCE or DIDFT_AXIS or DIDFT_OPTIONAL:.dwFlags=DIDOI_ASPECTFORCE:End With
716 With p[&HA0]:.pguid=VarPtr(GUID_RyAxis):.dwOfs=&H100:.dwType=DIDFT_ANYINSTANCE or DIDFT_AXIS or DIDFT_OPTIONAL:.dwFlags=DIDOI_ASPECTFORCE:End With
717 With p[&HA1]:.pguid=VarPtr(GUID_RzAxis):.dwOfs=&H104:.dwType=DIDFT_ANYINSTANCE or DIDFT_AXIS or DIDFT_OPTIONAL:.dwFlags=DIDOI_ASPECTFORCE:End With
718 With p[&HA2]:.pguid=VarPtr(GUID_Slider):.dwOfs=&H18:.dwType=DIDFT_ANYINSTANCE or DIDFT_AXIS or DIDFT_OPTIONAL:.dwFlags=DIDOI_ASPECTFORCE:End With
719 With p[&HA3]:.pguid=VarPtr(GUID_Slider):.dwOfs=&H1C:.dwType=DIDFT_ANYINSTANCE or DIDFT_AXIS or DIDFT_OPTIONAL:.dwFlags=DIDOI_ASPECTFORCE:End With
720End Sub
721Dim _System_dfDIJoystick2ObjectDataFormat[&HA3]=[
722 [0,&H00,DIDFT_ANYINSTANCE or DIDFT_AXIS or DIDFT_OPTIONAL,DIDOI_ASPECTPOSITION],
723 [0,&H04,DIDFT_ANYINSTANCE or DIDFT_AXIS or DIDFT_OPTIONAL,DIDOI_ASPECTPOSITION],
724 [0,&H08,DIDFT_ANYINSTANCE or DIDFT_AXIS or DIDFT_OPTIONAL,DIDOI_ASPECTPOSITION],
725 [0,&H0C,DIDFT_ANYINSTANCE or DIDFT_AXIS or DIDFT_OPTIONAL,DIDOI_ASPECTPOSITION],
726 [0,&H10,DIDFT_ANYINSTANCE or DIDFT_AXIS or DIDFT_OPTIONAL,DIDOI_ASPECTPOSITION],
727 [0,&H14,DIDFT_ANYINSTANCE or DIDFT_AXIS or DIDFT_OPTIONAL,DIDOI_ASPECTPOSITION],
728 [0,&H18,DIDFT_ANYINSTANCE or DIDFT_AXIS or DIDFT_OPTIONAL,DIDOI_ASPECTPOSITION],
729 [0,&H1C,DIDFT_ANYINSTANCE or DIDFT_AXIS or DIDFT_OPTIONAL,DIDOI_ASPECTPOSITION],
730 [0,&H20,DIDFT_ANYINSTANCE or DIDFT_POV or DIDFT_OPTIONAL,0],
731 [0,&H24,DIDFT_ANYINSTANCE or DIDFT_POV or DIDFT_OPTIONAL,0],
732 [0,&H28,DIDFT_ANYINSTANCE or DIDFT_POV or DIDFT_OPTIONAL,0],
733 [0,&H2C,DIDFT_ANYINSTANCE or DIDFT_POV or DIDFT_OPTIONAL,0]
734] As DIOBJECTDATAFORMAT
735_System_dfDIJoystick2ObjectDataFormat[0].pguid=VarPtr(GUID_XAxis)
736_System_dfDIJoystick2ObjectDataFormat[1].pguid=VarPtr(GUID_YAxis)
737_System_dfDIJoystick2ObjectDataFormat[2].pguid=VarPtr(GUID_ZAxis)
738_System_dfDIJoystick2ObjectDataFormat[3].pguid=VarPtr(GUID_RxAxis)
739_System_dfDIJoystick2ObjectDataFormat[4].pguid=VarPtr(GUID_RyAxis)
740_System_dfDIJoystick2ObjectDataFormat[5].pguid=VarPtr(GUID_RzAxis)
741_System_dfDIJoystick2ObjectDataFormat[6].pguid=VarPtr(GUID_Slider)
742_System_dfDIJoystick2ObjectDataFormat[7].pguid=VarPtr(GUID_Slider)
743_System_dfDIJoystick2ObjectDataFormat[8].pguid=VarPtr(GUID_POV)
744_System_dfDIJoystick2ObjectDataFormat[9].pguid=VarPtr(GUID_POV)
745_System_dfDIJoystick2ObjectDataFormat[10].pguid=VarPtr(GUID_POV)
746_System_dfDIJoystick2ObjectDataFormat[11].pguid=VarPtr(GUID_POV)
747_System_DirectInput_Joystick2_SetDataType(_System_dfDIJoystickObjectDataFormat)
748Dim c_dfDIJoystick2=[24,16,DIDF_ABSAXIS,&H110,&HA4,0] As DIDATAFORMAT
749c_dfDIJoystick2.rgodf=_System_dfDIJoystick2ObjectDataFormat
750
751
752#endif '_INC_DINPUT
Note: See TracBrowser for help on using the repository browser.