1/**************************************************************************** 2 * 3 * Copyright (C) 1996 Microsoft Corporation. All Rights Reserved. 4 * 5 * File: dinput.h 6 * Content: DirectInput include file 7 * 8 ****************************************************************************/ 9 10#ifndef __DINPUT_INCLUDED__ 11#define __DINPUT_INCLUDED__ 12 13#ifdef _WIN32 14#define COM_NO_WINDOWS_H 15#include <objbase.h> 16#endif 17 18#ifdef __cplusplus 19extern "C" { 20#endif 21 22#define DIRECTINPUT_VERSION 0x0300 23 24/**************************************************************************** 25 * 26 * Class IDs 27 * 28 ****************************************************************************/ 29 30DEFINE_GUID(CLSID_DirectInput, 0x25E609E0,0xB259,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); 31DEFINE_GUID(CLSID_DirectInputDevice,0x25E609E1,0xB259,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); 32 33/**************************************************************************** 34 * 35 * Interfaces 36 * 37 ****************************************************************************/ 38 39DEFINE_GUID(IID_IDirectInputA, 0x89521360,0xAA8A,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); 40DEFINE_GUID(IID_IDirectInputW, 0x89521361,0xAA8A,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); 41 42DEFINE_GUID(IID_IDirectInputDeviceA,0x5944E680,0xC92E,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); 43DEFINE_GUID(IID_IDirectInputDeviceW,0x5944E681,0xC92E,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); 44 45/**************************************************************************** 46 * 47 * Predefined object types 48 * 49 ****************************************************************************/ 50 51DEFINE_GUID(GUID_XAxis, 0xA36D02E0,0xC9F3,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); 52DEFINE_GUID(GUID_YAxis, 0xA36D02E1,0xC9F3,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); 53DEFINE_GUID(GUID_ZAxis, 0xA36D02E2,0xC9F3,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); 54DEFINE_GUID(GUID_RAxis, 0xA36D02E3,0xC9F3,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); 55DEFINE_GUID(GUID_UAxis, 0xA36D02E4,0xC9F3,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); 56DEFINE_GUID(GUID_VAxis, 0xA36D02E5,0xC9F3,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); 57 58DEFINE_GUID(GUID_Button, 0xA36D02F0,0xC9F3,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); 59DEFINE_GUID(GUID_Key, 0x55728220,0xD33C,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); 60 61DEFINE_GUID(GUID_POV, 0xA36D02F2,0xC9F3,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); 62 63/**************************************************************************** 64 * 65 * Predefined product GUIDs 66 * 67 ****************************************************************************/ 68 69DEFINE_GUID(GUID_SysMouse, 0x6F1D2B60,0xD5A0,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); 70DEFINE_GUID(GUID_SysKeyboard,0x6F1D2B61,0xD5A0,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); 71 72/**************************************************************************** 73 * 74 * Interfaces and Structures... 75 * 76 ****************************************************************************/ 77 78/**************************************************************************** 79 * 80 * IDirectInputDevice 81 * 82 ****************************************************************************/ 83 84#define DIDEVTYPE_DEVICE 1 85#define DIDEVTYPE_MOUSE 2 86#define DIDEVTYPE_KEYBOARD 3 87#define DIDEVTYPE_JOYSTICK 4 88 89#define DIDEVTYPEMOUSE_UNKNOWN 1 90#define DIDEVTYPEMOUSE_TRADITIONAL 2 91#define DIDEVTYPEMOUSE_FINGERSTICK 3 92#define DIDEVTYPEMOUSE_TOUCHPAD 4 93#define DIDEVTYPEMOUSE_TRACKBALL 5 94 95#define DIDEVTYPEKEYBOARD_PCXT 1 96#define DIDEVTYPEKEYBOARD_OLIVETTI 2 97#define DIDEVTYPEKEYBOARD_PCAT 3 98#define DIDEVTYPEKEYBOARD_PCENH 4 99#define DIDEVTYPEKEYBOARD_NOKIA1050 5 100#define DIDEVTYPEKEYBOARD_NOKIA9140 6 101#define DIDEVTYPEKEYBOARD_NEC98 7 102#define DIDEVTYPEKEYBOARD_NEC98LAPTOP 8 103#define DIDEVTYPEKEYBOARD_NEC98106 9 104#define DIDEVTYPEKEYBOARD_JAPAN106 10 105#define DIDEVTYPEKEYBOARD_JAPANAX 11 106#define DIDEVTYPEKEYBOARD_J3100 12 107 108#define GET_DIDEVICE_TYPE(dwDevType) LOBYTE(dwDevType) 109#define GET_DIDEVICE_SUBTYPE(dwDevType) HIBYTE(dwDevType) 110 111typedef struct _DIDEVCAPS { 112 DWORD dwSize; 113 DWORD dwFlags; 114 DWORD dwDevType; 115 DWORD dwAxes; 116 DWORD dwButtons; 117 DWORD dwPOVs; 118} DIDEVCAPS, *LPDIDEVCAPS; 119 120#define DIDC_ATTACHED 0x00000001 121#define DIDC_POLLEDDEVICE 0x00000002 122 123#define DIDFT_ALL 0x00000000 124 125#define DIDFT_RELAXIS 0x00000001 126#define DIDFT_ABSAXIS 0x00000002 127#define DIDFT_AXIS 0x00000003 128 129#define DIDFT_PSHBUTTON 0x00000004 130#define DIDFT_TGLBUTTON 0x00000008 131#define DIDFT_BUTTON 0x0000000C 132 133#define DIDFT_POV 0x00000010 134 135#define DIDFT_ANYINSTANCE 0x0000FF00 136#define DIDFT_MAKEINSTANCE(n) ((BYTE)(n) << 8) 137#define DIDFT_GETTYPE(n) LOBYTE(n) 138#define DIDFT_GETINSTANCE(n) HIBYTE(n) 139 140typedef struct _DIOBJECTDATAFORMAT { 141 const GUID *pguid; 142 DWORD dwOfs; 143 DWORD dwType; 144 DWORD dwFlags; 145} DIOBJECTDATAFORMAT, *LPDIOBJECTDATAFORMAT; 146typedef const DIOBJECTDATAFORMAT *LPCDIOBJECTDATAFORMAT; 147 148typedef struct _DIDATAFORMAT { 149 DWORD dwSize; 150 DWORD dwObjSize; 151 DWORD dwFlags; 152 DWORD dwDataSize; 153 DWORD dwNumObjs; 154 LPDIOBJECTDATAFORMAT rgodf; 155} DIDATAFORMAT, *LPDIDATAFORMAT; 156typedef const DIDATAFORMAT *LPCDIDATAFORMAT; 157 158#define DIDF_ABSAXIS 0x00000001 159#define DIDF_RELAXIS 0x00000002 160 161extern const DIDATAFORMAT c_dfDIMouse; 162extern const DIDATAFORMAT c_dfDIKeyboard; 163 164typedef struct DIDEVICEOBJECTINSTANCEA { 165 DWORD dwSize; 166 GUID guidType; 167 DWORD dwOfs; 168 DWORD dwType; 169 DWORD dwFlags; 170 CHAR tszName[MAX_PATH]; 171} DIDEVICEOBJECTINSTANCEA, *LPDIDEVICEOBJECTINSTANCEA; 172typedef struct DIDEVICEOBJECTINSTANCEW { 173 DWORD dwSize; 174 GUID guidType; 175 DWORD dwOfs; 176 DWORD dwType; 177 DWORD dwFlags; 178 WCHAR tszName[MAX_PATH]; 179} DIDEVICEOBJECTINSTANCEW, *LPDIDEVICEOBJECTINSTANCEW; 180#ifdef UNICODE 181typedef DIDEVICEOBJECTINSTANCEW DIDEVICEOBJECTINSTANCE; 182typedef LPDIDEVICEOBJECTINSTANCEW LPDIDEVICEOBJECTINSTANCE; 183#else 184typedef DIDEVICEOBJECTINSTANCEA DIDEVICEOBJECTINSTANCE; 185typedef LPDIDEVICEOBJECTINSTANCEA LPDIDEVICEOBJECTINSTANCE; 186#endif // UNICODE 187typedef const DIDEVICEOBJECTINSTANCEA *LPCDIDEVICEOBJECTINSTANCEA; 188typedef const DIDEVICEOBJECTINSTANCEW *LPCDIDEVICEOBJECTINSTANCEW; 189typedef const DIDEVICEOBJECTINSTANCE *LPCDIDEVICEOBJECTINSTANCE; 190 191typedef BOOL (FAR PASCAL * LPDIENUMDEVICEOBJECTSCALLBACKA)(LPCDIDEVICEOBJECTINSTANCEA, LPVOID); 192typedef BOOL (FAR PASCAL * LPDIENUMDEVICEOBJECTSCALLBACKW)(LPCDIDEVICEOBJECTINSTANCEW, LPVOID); 193#ifdef UNICODE 194#define LPDIENUMDEVICEOBJECTSCALLBACK LPDIENUMDEVICEOBJECTSCALLBACKW 195#else 196#define LPDIENUMDEVICEOBJECTSCALLBACK LPDIENUMDEVICEOBJECTSCALLBACKA 197#endif // !UNICODE 198 199typedef struct DIPROPHEADER { 200 DWORD dwSize; 201 DWORD dwHeaderSize; 202 DWORD dwObj; 203 DWORD dwHow; 204} DIPROPHEADER, *LPDIPROPHEADER; 205typedef const DIPROPHEADER *LPCDIPROPHEADER; 206 207#define DIPH_DEVICE 0 208#define DIPH_BYOFFSET 1 209#define DIPH_BYID 2 210 211typedef struct DIPROPDWORD { 212 DIPROPHEADER diph; 213 DWORD dwData; 214} DIPROPDWORD, *LPDIPROPDWORD; 215typedef const DIPROPDWORD *LPCDIPROPDWORD; 216 217typedef struct DIPROPRANGE { 218 DIPROPHEADER diph; 219 LONG lMin; 220 LONG lMax; 221} DIPROPRANGE, *LPDIPROPRANGE; 222typedef const DIPROPRANGE *LPCDIPROPRANGE; 223 224#define DIPROPRANGE_NOMIN ((LONG)0x80000000) 225#define DIPROPRANGE_NOMAX ((LONG)0x7FFFFFFF) 226 227#ifdef __cplusplus 228#define MAKEDIPROP(prop) (*(const GUID *)(prop)) 229#else 230#define MAKEDIPROP(prop) ((REFGUID)(prop)) 231#endif 232 233#define DIPROP_BUFFERSIZE MAKEDIPROP(1) 234 235#define DIPROP_AXISMODE MAKEDIPROP(2) 236 237#define DIPROPAXISMODE_ABS 0 238#define DIPROPAXISMODE_REL 1 239 240#define DIPROP_GRANULARITY MAKEDIPROP(3) 241 242#define DIPROP_RANGE MAKEDIPROP(4) 243 244typedef struct DIDEVICEOBJECTDATA { 245 DWORD dwOfs; 246 DWORD dwData; 247 DWORD dwTimeStamp; 248 DWORD dwSequence; 249} DIDEVICEOBJECTDATA, *LPDIDEVICEOBJECTDATA; 250 251#define DIGDD_PEEK 0x00000001 252 253#define DISEQUENCE_COMPARE(dwSequence1, cmp, dwSequence2) \ 254 ((int)((dwSequence1) - (dwSequence2)) cmp 0) 255 256#define DISCL_EXCLUSIVE 0x00000001 257#define DISCL_NONEXCLUSIVE 0x00000002 258#define DISCL_FOREGROUND 0x00000004 259#define DISCL_BACKGROUND 0x00000008 260 261typedef struct DIDEVICEINSTANCEA { 262 DWORD dwSize; 263 GUID guidInstance; 264 GUID guidProduct; 265 DWORD dwDevType; 266 CHAR tszInstanceName[MAX_PATH]; 267 CHAR tszProductName[MAX_PATH]; 268} DIDEVICEINSTANCEA, *LPDIDEVICEINSTANCEA; 269typedef struct DIDEVICEINSTANCEW { 270 DWORD dwSize; 271 GUID guidInstance; 272 GUID guidProduct; 273 DWORD dwDevType; 274 WCHAR tszInstanceName[MAX_PATH]; 275 WCHAR tszProductName[MAX_PATH]; 276} DIDEVICEINSTANCEW, *LPDIDEVICEINSTANCEW; 277#ifdef UNICODE 278typedef DIDEVICEINSTANCEW DIDEVICEINSTANCE; 279typedef LPDIDEVICEINSTANCEW LPDIDEVICEINSTANCE; 280#else 281typedef DIDEVICEINSTANCEA DIDEVICEINSTANCE; 282typedef LPDIDEVICEINSTANCEA LPDIDEVICEINSTANCE; 283#endif // UNICODE 284typedef const DIDEVICEINSTANCEA *LPCDIDEVICEINSTANCEA; 285typedef const DIDEVICEINSTANCEW *LPCDIDEVICEINSTANCEW; 286typedef const DIDEVICEINSTANCE *LPCDIDEVICEINSTANCE; 287 288#undef INTERFACE 289#define INTERFACE IDirectInputDeviceW 290 291DECLARE_INTERFACE_(IDirectInputDeviceW, IUnknown) 292{ 293 /*** IUnknown methods ***/ 294 STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE; 295 STDMETHOD_(ULONG,AddRef)(THIS) PURE; 296 STDMETHOD_(ULONG,Release)(THIS) PURE; 297 298 /*** IDirectInputDeviceW methods ***/ 299 STDMETHOD(GetCapabilities)(THIS_ LPDIDEVCAPS) PURE; 300 STDMETHOD(EnumObjects)(THIS_ LPDIENUMDEVICEOBJECTSCALLBACKW,LPVOID,DWORD) PURE; 301 STDMETHOD(GetProperty)(THIS_ REFGUID,LPDIPROPHEADER) PURE; 302 STDMETHOD(SetProperty)(THIS_ REFGUID,LPCDIPROPHEADER) PURE; 303 STDMETHOD(Acquire)(THIS) PURE; 304 STDMETHOD(Unacquire)(THIS) PURE; 305 STDMETHOD(GetDeviceState)(THIS_ DWORD,LPVOID) PURE; 306 STDMETHOD(GetDeviceData)(THIS_ DWORD,LPDIDEVICEOBJECTDATA,LPDWORD,DWORD) PURE; 307 STDMETHOD(SetDataFormat)(THIS_ LPCDIDATAFORMAT) PURE; 308 STDMETHOD(SetEventNotification)(THIS_ HANDLE) PURE; 309 STDMETHOD(SetCooperativeLevel)(THIS_ HWND,DWORD) PURE; 310 STDMETHOD(GetObjectInfo)(THIS_ LPDIDEVICEOBJECTINSTANCEW,DWORD,DWORD) PURE; 311 STDMETHOD(GetDeviceInfo)(THIS_ LPDIDEVICEINSTANCEW) PURE; 312 STDMETHOD(RunControlPanel)(THIS_ HWND,DWORD) PURE; 313 STDMETHOD(Initialize)(THIS_ HINSTANCE,DWORD,REFGUID) PURE; 314}; 315 316typedef struct IDirectInputDeviceW *LPDIRECTINPUTDEVICEW; 317 318#undef INTERFACE 319#define INTERFACE IDirectInputDeviceA 320 321DECLARE_INTERFACE_(IDirectInputDeviceA, IUnknown) 322{ 323 /*** IUnknown methods ***/ 324 STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE; 325 STDMETHOD_(ULONG,AddRef)(THIS) PURE; 326 STDMETHOD_(ULONG,Release)(THIS) PURE; 327 328 /*** IDirectInputDeviceA methods ***/ 329 STDMETHOD(GetCapabilities)(THIS_ LPDIDEVCAPS) PURE; 330 STDMETHOD(EnumObjects)(THIS_ LPDIENUMDEVICEOBJECTSCALLBACKA,LPVOID,DWORD) PURE; 331 STDMETHOD(GetProperty)(THIS_ REFGUID,LPDIPROPHEADER) PURE; 332 STDMETHOD(SetProperty)(THIS_ REFGUID,LPCDIPROPHEADER) PURE; 333 STDMETHOD(Acquire)(THIS) PURE; 334 STDMETHOD(Unacquire)(THIS) PURE; 335 STDMETHOD(GetDeviceState)(THIS_ DWORD,LPVOID) PURE; 336 STDMETHOD(GetDeviceData)(THIS_ DWORD,LPDIDEVICEOBJECTDATA,LPDWORD,DWORD) PURE; 337 STDMETHOD(SetDataFormat)(THIS_ LPCDIDATAFORMAT) PURE; 338 STDMETHOD(SetEventNotification)(THIS_ HANDLE) PURE; 339 STDMETHOD(SetCooperativeLevel)(THIS_ HWND,DWORD) PURE; 340 STDMETHOD(GetObjectInfo)(THIS_ LPDIDEVICEOBJECTINSTANCEA,DWORD,DWORD) PURE; 341 STDMETHOD(GetDeviceInfo)(THIS_ LPDIDEVICEINSTANCEA) PURE; 342 STDMETHOD(RunControlPanel)(THIS_ HWND,DWORD) PURE; 343 STDMETHOD(Initialize)(THIS_ HINSTANCE,DWORD,REFGUID) PURE; 344}; 345 346typedef struct IDirectInputDeviceA *LPDIRECTINPUTDEVICEA; 347 348#ifdef UNICODE 349#define IID_IDirectInputDevice IID_IDirectInputDeviceW 350#define IDirectInputDevice IDirectInputDeviceW 351#define IDirectInputDeviceVtbl IDirectInputDeviceWVtbl 352#else 353#define IID_IDirectInputDevice IID_IDirectInputDeviceA 354#define IDirectInputDevice IDirectInputDeviceA 355#define IDirectInputDeviceVtbl IDirectInputDeviceAVtbl 356#endif 357typedef struct IDirectInputDevice *LPDIRECTINPUTDEVICE; 358 359#if !defined(__cplusplus) || defined(CINTERFACE) 360#define IDirectInputDevice_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) 361#define IDirectInputDevice_AddRef(p) (p)->lpVtbl->AddRef(p) 362#define IDirectInputDevice_Release(p) (p)->lpVtbl->Release(p) 363#define IDirectInputDevice_GetCapabilities(p,a) (p)->lpVtbl->GetCapabilities(p,a) 364#define IDirectInputDevice_EnumObjects(p,a,b,c) (p)->lpVtbl->EnumObjects(p,a,b,c) 365#define IDirectInputDevice_GetProperty(p,a,b) (p)->lpVtbl->GetProperty(p,a,b) 366#define IDirectInputDevice_SetProperty(p,a,b) (p)->lpVtbl->SetProperty(p,a,b) 367#define IDirectInputDevice_Acquire(p) (p)->lpVtbl->Acquire(p) 368#define IDirectInputDevice_Unacquire(p) (p)->lpVtbl->Unacquire(p) 369#define IDirectInputDevice_GetDeviceState(p,a,b) (p)->lpVtbl->GetDeviceState(p,a,b) 370#define IDirectInputDevice_GetDeviceData(p,a,b,c,d) (p)->lpVtbl->GetDeviceData(p,a,b,c,d) 371#define IDirectInputDevice_SetDataFormat(p,a) (p)->lpVtbl->SetDataFormat(p,a) 372#define IDirectInputDevice_SetEventNotification(p,a) (p)->lpVtbl->SetEventNotification(p,a) 373#define IDirectInputDevice_SetCooperativeLevel(p,a,b) (p)->lpVtbl->SetCooperativeLevel(p,a,b) 374#define IDirectInputDevice_GetObjectInfo(p,a,b,c) (p)->lpVtbl->GetObjectInfo(p,a,b,c) 375#define IDirectInputDevice_GetDeviceInfo(p,a) (p)->lpVtbl->GetDeviceInfo(p,a) 376#define IDirectInputDevice_RunControlPanel(p,a,b) (p)->lpVtbl->RunControlPanel(p,a,b) 377#define IDirectInputDevice_Initialize(p,a,b,c) (p)->lpVtbl->Initialize(p,a,b,c) 378#endif 379 380/**************************************************************************** 381 * 382 * Mouse 383 * 384 ****************************************************************************/ 385 386typedef struct _DIMOUSESTATE { 387 LONG lX; 388 LONG lY; 389 LONG lZ; 390 BYTE rgbButtons[4]; 391} DIMOUSESTATE, *LPDIMOUSESTATE; 392 393#define DIMOFS_X FIELD_OFFSET(DIMOUSESTATE, lX) 394#define DIMOFS_Y FIELD_OFFSET(DIMOUSESTATE, lY) 395#define DIMOFS_Z FIELD_OFFSET(DIMOUSESTATE, lZ) 396#define DIMOFS_BUTTON0 (FIELD_OFFSET(DIMOUSESTATE, rgbButtons) + 0) 397#define DIMOFS_BUTTON1 (FIELD_OFFSET(DIMOUSESTATE, rgbButtons) + 1) 398#define DIMOFS_BUTTON2 (FIELD_OFFSET(DIMOUSESTATE, rgbButtons) + 2) 399#define DIMOFS_BUTTON3 (FIELD_OFFSET(DIMOUSESTATE, rgbButtons) + 3) 400 401/**************************************************************************** 402 * 403 * Keyboard 404 * 405 ****************************************************************************/ 406 407/**************************************************************************** 408 * 409 * DirectInput keyboard scan codes 410 * 411 ****************************************************************************/ 412 413#define DIK_ESCAPE 0x01 414#define DIK_1 0x02 415#define DIK_2 0x03 416#define DIK_3 0x04 417#define DIK_4 0x05 418#define DIK_5 0x06 419#define DIK_6 0x07 420#define DIK_7 0x08 421#define DIK_8 0x09 422#define DIK_9 0x0A 423#define DIK_0 0x0B 424#define DIK_MINUS 0x0C /* - on main keyboard */ 425#define DIK_EQUALS 0x0D 426#define DIK_BACK 0x0E /* backspace */ 427#define DIK_TAB 0x0F 428#define DIK_Q 0x10 429#define DIK_W 0x11 430#define DIK_E 0x12 431#define DIK_R 0x13 432#define DIK_T 0x14 433#define DIK_Y 0x15 434#define DIK_U 0x16 435#define DIK_I 0x17 436#define DIK_O 0x18 437#define DIK_P 0x19 438#define DIK_LBRACKET 0x1A 439#define DIK_RBRACKET 0x1B 440#define DIK_RETURN 0x1C /* Enter on main keyboard */ 441#define DIK_LCONTROL 0x1D 442#define DIK_A 0x1E 443#define DIK_S 0x1F 444#define DIK_D 0x20 445#define DIK_F 0x21 446#define DIK_G 0x22 447#define DIK_H 0x23 448#define DIK_J 0x24 449#define DIK_K 0x25 450#define DIK_L 0x26 451#define DIK_SEMICOLON 0x27 452#define DIK_APOSTROPHE 0x28 453#define DIK_GRAVE 0x29 /* accent grave */ 454#define DIK_LSHIFT 0x2A 455#define DIK_BACKSLASH 0x2B 456#define DIK_Z 0x2C 457#define DIK_X 0x2D 458#define DIK_C 0x2E 459#define DIK_V 0x2F 460#define DIK_B 0x30 461#define DIK_N 0x31 462#define DIK_M 0x32 463#define DIK_COMMA 0x33 464#define DIK_PERIOD 0x34 /* . on main keyboard */ 465#define DIK_SLASH 0x35 /* / on main keyboard */ 466#define DIK_RSHIFT 0x36 467#define DIK_MULTIPLY 0x37 /* * on numeric keypad */ 468#define DIK_LMENU 0x38 /* left Alt */ 469#define DIK_SPACE 0x39 470#define DIK_CAPITAL 0x3A 471#define DIK_F1 0x3B 472#define DIK_F2 0x3C 473#define DIK_F3 0x3D 474#define DIK_F4 0x3E 475#define DIK_F5 0x3F 476#define DIK_F6 0x40 477#define DIK_F7 0x41 478#define DIK_F8 0x42 479#define DIK_F9 0x43 480#define DIK_F10 0x44 481#define DIK_NUMLOCK 0x45 482#define DIK_SCROLL 0x46 /* Scroll Lock */ 483#define DIK_NUMPAD7 0x47 484#define DIK_NUMPAD8 0x48 485#define DIK_NUMPAD9 0x49 486#define DIK_SUBTRACT 0x4A /* - on numeric keypad */ 487#define DIK_NUMPAD4 0x4B 488#define DIK_NUMPAD5 0x4C 489#define DIK_NUMPAD6 0x4D 490#define DIK_ADD 0x4E /* + on numeric keypad */ 491#define DIK_NUMPAD1 0x4F 492#define DIK_NUMPAD2 0x50 493#define DIK_NUMPAD3 0x51 494#define DIK_NUMPAD0 0x52 495#define DIK_DECIMAL 0x53 /* . on numeric keypad */ 496#define DIK_F11 0x57 497#define DIK_F12 0x58 498 499#define DIK_F13 0x64 /* (NEC PC98) */ 500#define DIK_F14 0x65 /* (NEC PC98) */ 501#define DIK_F15 0x66 /* (NEC PC98) */ 502 503#define DIK_KANA 0x70 /* (Japanese keyboard) */ 504#define DIK_CONVERT 0x79 /* (Japanese keyboard) */ 505#define DIK_NOCONVERT 0x7B /* (Japanese keyboard) */ 506#define DIK_YEN 0x7D /* (Japanese keyboard) */ 507#define DIK_NUMPADEQUALS 0x8D /* = on numeric keypad (NEC PC98) */ 508#define DIK_CIRCUMFLEX 0x90 /* (Japanese keyboard) */ 509#define DIK_AT 0x91 /* (NEC PC98) */ 510#define DIK_COLON 0x92 /* (NEC PC98) */ 511#define DIK_UNDERLINE 0x93 /* (NEC PC98) */ 512#define DIK_KANJI 0x94 /* (Japanese keyboard) */ 513#define DIK_STOP 0x95 /* (NEC PC98) */ 514#define DIK_AX 0x96 /* (Japan AX) */ 515#define DIK_UNLABELED 0x97 /* (J3100) */ 516#define DIK_NUMPADENTER 0x9C /* Enter on numeric keypad */ 517#define DIK_RCONTROL 0x9D 518#define DIK_NUMPADCOMMA 0xB3 /* , on numeric keypad (NEC PC98) */ 519#define DIK_DIVIDE 0xB5 /* / on numeric keypad */ 520#define DIK_SYSRQ 0xB7 521#define DIK_RMENU 0xB8 /* right Alt */ 522#define DIK_HOME 0xC7 /* Home on arrow keypad */ 523#define DIK_UP 0xC8 /* UpArrow on arrow keypad */ 524#define DIK_PRIOR 0xC9 /* PgUp on arrow keypad */ 525#define DIK_LEFT 0xCB /* LeftArrow on arrow keypad */ 526#define DIK_RIGHT 0xCD /* RightArrow on arrow keypad */ 527#define DIK_END 0xCF /* End on arrow keypad */ 528#define DIK_DOWN 0xD0 /* DownArrow on arrow keypad */ 529#define DIK_NEXT 0xD1 /* PgDn on arrow keypad */ 530#define DIK_INSERT 0xD2 /* Insert on arrow keypad */ 531#define DIK_DELETE 0xD3 /* Delete on arrow keypad */ 532#define DIK_LWIN 0xDB /* Left Windows key */ 533#define DIK_RWIN 0xDC /* Right Windows key */ 534#define DIK_APPS 0xDD /* AppMenu key */ 535 536/* 537 * Alternate names for keys, to facilitate transition from DOS. 538 */ 539#define DIK_BACKSPACE DIK_BACK /* backspace */ 540#define DIK_NUMPADSTAR DIK_MULTIPLY /* * on numeric keypad */ 541#define DIK_LALT DIK_LMENU /* left Alt */ 542#define DIK_CAPSLOCK DIK_CAPITAL /* CapsLock */ 543#define DIK_NUMPADMINUS DIK_SUBTRACT /* - on numeric keypad */ 544#define DIK_NUMPADPLUS DIK_ADD /* + on numeric keypad */ 545#define DIK_NUMPADPERIOD DIK_DECIMAL /* . on numeric keypad */ 546#define DIK_NUMPADSLASH DIK_DIVIDE /* / on numeric keypad */ 547#define DIK_RALT DIK_RMENU /* right Alt */ 548#define DIK_UPARROW DIK_UP /* UpArrow on arrow keypad */ 549#define DIK_PGUP DIK_PRIOR /* PgUp on arrow keypad */ 550#define DIK_LEFTARROW DIK_LEFT /* LeftArrow on arrow keypad */ 551#define DIK_RIGHTARROW DIK_RIGHT /* RightArrow on arrow keypad */ 552#define DIK_DOWNARROW DIK_DOWN /* DownArrow on arrow keypad */ 553#define DIK_PGDN DIK_NEXT /* PgDn on arrow keypad */ 554 555/**************************************************************************** 556 * 557 * IDirectInput 558 * 559 ****************************************************************************/ 560 561#define DIENUM_STOP 0 562#define DIENUM_CONTINUE 1 563 564typedef BOOL (FAR PASCAL * LPDIENUMDEVICESCALLBACKA)(LPCDIDEVICEINSTANCEA, LPVOID); 565typedef BOOL (FAR PASCAL * LPDIENUMDEVICESCALLBACKW)(LPCDIDEVICEINSTANCEW, LPVOID); 566#ifdef UNICODE 567#define LPDIENUMDEVICESCALLBACK LPDIENUMDEVICESCALLBACKW 568#else 569#define LPDIENUMDEVICESCALLBACK LPDIENUMDEVICESCALLBACKA 570#endif // !UNICODE 571 572#define DIEDFL_ALLDEVICES 0x00000000 573#define DIEDFL_ATTACHEDONLY 0x00000001 574 575#undef INTERFACE 576#define INTERFACE IDirectInputW 577 578DECLARE_INTERFACE_(IDirectInputW, IUnknown) 579{ 580 /*** IUnknown methods ***/ 581 STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE; 582 STDMETHOD_(ULONG,AddRef)(THIS) PURE; 583 STDMETHOD_(ULONG,Release)(THIS) PURE; 584 585 /*** IDirectInputW methods ***/ 586 STDMETHOD(CreateDevice)(THIS_ REFGUID,LPDIRECTINPUTDEVICEW *,LPUNKNOWN) PURE; 587 STDMETHOD(EnumDevices)(THIS_ DWORD,LPDIENUMDEVICESCALLBACKW,LPVOID,DWORD) PURE; 588 STDMETHOD(GetDeviceStatus)(THIS_ REFGUID) PURE; 589 STDMETHOD(RunControlPanel)(THIS_ HWND,DWORD) PURE; 590 STDMETHOD(Initialize)(THIS_ HINSTANCE,DWORD) PURE; 591}; 592 593typedef struct IDirectInputW *LPDIRECTINPUTW; 594 595#undef INTERFACE 596#define INTERFACE IDirectInputA 597 598DECLARE_INTERFACE_(IDirectInputA, IUnknown) 599{ 600 /*** IUnknown methods ***/ 601 STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE; 602 STDMETHOD_(ULONG,AddRef)(THIS) PURE; 603 STDMETHOD_(ULONG,Release)(THIS) PURE; 604 605 /*** IDirectInputA methods ***/ 606 STDMETHOD(CreateDevice)(THIS_ REFGUID,LPDIRECTINPUTDEVICEA *,LPUNKNOWN) PURE; 607 STDMETHOD(EnumDevices)(THIS_ DWORD,LPDIENUMDEVICESCALLBACKA,LPVOID,DWORD) PURE; 608 STDMETHOD(GetDeviceStatus)(THIS_ REFGUID) PURE; 609 STDMETHOD(RunControlPanel)(THIS_ HWND,DWORD) PURE; 610 STDMETHOD(Initialize)(THIS_ HINSTANCE,DWORD) PURE; 611}; 612 613typedef struct IDirectInputA *LPDIRECTINPUTA; 614 615#ifdef UNICODE 616#define IID_IDirectInput IID_IDirectInputW 617#define IDirectInput IDirectInputW 618#define IDirectInputVtbl IDirectInputWVtbl 619#else 620#define IID_IDirectInput IID_IDirectInputA 621#define IDirectInput IDirectInputA 622#define IDirectInputVtbl IDirectInputAVtbl 623#endif 624typedef struct IDirectInput *LPDIRECTINPUT; 625 626#if !defined(__cplusplus) || defined(CINTERFACE) 627#define IDirectInput_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) 628#define IDirectInput_AddRef(p) (p)->lpVtbl->AddRef(p) 629#define IDirectInput_Release(p) (p)->lpVtbl->Release(p) 630#define IDirectInput_CreateDevice(p,a,b,c) (p)->lpVtbl->CreateDevice(p,a,b,c) 631#define IDirectInput_EnumDevices(p,a,b,c,d) (p)->lpVtbl->EnumDevices(p,a,b,c,d) 632#define IDirectInput_GetDeviceStatus(p,a) (p)->lpVtbl->GetDeviceStatus(p,a) 633#define IDirectInput_RunControlPanel(p,a,b) (p)->lpVtbl->RunControlPanel(p,a,b) 634#define IDirectInput_Initialize(p,a,b) (p)->lpVtbl->Initialize(p,a,b) 635#endif 636 637extern HRESULT WINAPI DirectInputCreateA(HINSTANCE hinst, DWORD dwVersion, LPDIRECTINPUTA *ppDI, LPUNKNOWN punkOuter); 638extern HRESULT WINAPI DirectInputCreateW(HINSTANCE hinst, DWORD dwVersion, LPDIRECTINPUTW *ppDI, LPUNKNOWN punkOuter); 639#ifdef UNICODE 640#define DirectInputCreate DirectInputCreateW 641#else 642#define DirectInputCreate DirectInputCreateA 643#endif // !UNICODE 644 645/**************************************************************************** 646 * 647 * Return Codes 648 * 649 ****************************************************************************/ 650 651/* 652 * The operation completed successfully. 653 */ 654#define DI_OK S_OK 655 656/* 657 * The device exists but is not currently attached. 658 */ 659#define DI_NOTATTACHED S_FALSE 660 661/* 662 * The device buffer overflowed; some input was lost. 663 */ 664#define DI_BUFFEROVERFLOW S_FALSE 665 666/* 667 * The change in device properties had no effect. 668 */ 669#define DI_PROPNOEFFECT S_FALSE 670 671/* 672 * The device is a polled device. As a result, device buffering 673 * will not collect any data and event notifications will not be 674 * signalled until GetDeviceState is called. 675 */ 676#define DI_POLLEDDEVICE ((HRESULT)0x00000002L) 677 678/* 679 * The application requires a newer version of DirectInput. 680 */ 681#define DIERR_OLDDIRECTINPUTVERSION \ 682 MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_OLD_WIN_VERSION) 683 684/* 685 * The application was written for an unsupported prerelease version 686 * of DirectInput. 687 */ 688#define DIERR_BETADIRECTINPUTVERSION \ 689 MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_RMODE_APP) 690 691/* 692 * The object could not be created due to an incompatible driver version 693 * or mismatched or incomplete driver components. 694 */ 695#define DIERR_BADDRIVERVER \ 696 MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_BAD_DRIVER_LEVEL) 697 698/* 699 * The device or device instance is not registered with DirectInput. 700 */ 701#define DIERR_DEVICENOTREG REGDB_E_CLASSNOTREG 702 703/* 704 * The requested object does not exist. 705 */ 706#define DIERR_OBJECTNOTFOUND \ 707 MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_FILE_NOT_FOUND) 708 709/* 710 * An invalid parameter was passed to the returning function, 711 * or the object was not in a state that admitted the function 712 * to be called. 713 */ 714#define DIERR_INVALIDPARAM E_INVALIDARG 715 716/* 717 * The specified interface is not supported by the object 718 */ 719#define DIERR_NOINTERFACE E_NOINTERFACE 720 721/* 722 * An undetermined error occured inside the DInput subsystem 723 */ 724#define DIERR_GENERIC E_FAIL 725 726/* 727 * The DInput subsystem couldn't allocate sufficient memory to complete the 728 * caller's request. 729 */ 730#define DIERR_OUTOFMEMORY E_OUTOFMEMORY 731 732/* 733 * The function called is not supported at this time 734 */ 735#define DIERR_UNSUPPORTED E_NOTIMPL 736 737/* 738 * This object has not been initialized 739 */ 740#define DIERR_NOTINITIALIZED \ 741 MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_NOT_READY) 742 743/* 744 * This object is already initialized 745 */ 746#define DIERR_ALREADYINITIALIZED \ 747 MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_ALREADY_INITIALIZED) 748 749/* 750 * This object does not support aggregation 751 */ 752#define DIERR_NOAGGREGATION CLASS_E_NOAGGREGATION 753 754/* 755 * Another app has a higher priority level, preventing this call from 756 * succeeding. 757 */ 758#define DIERR_OTHERAPPHASPRIO E_ACCESSDENIED 759 760/* 761 * Access to the input device has been lost. It must be re-acquired. 762 */ 763#define DIERR_INPUTLOST \ 764 MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_READ_FAULT) 765 766/* 767 * The operation cannot be performed while the device is acquired. 768 */ 769#define DIERR_ACQUIRED \ 770 MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_BUSY) 771 772/* 773 * The operation cannot be performed unless the device is acquired. 774 */ 775#define DIERR_NOTACQUIRED \ 776 MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_INVALID_ACCESS) 777 778/* 779 * The specified property cannot be changed. 780 */ 781#define DIERR_READONLY E_ACCESSDENIED 782 783/* 784 * The device already has an event notification associated with it. 785 */ 786#define DIERR_HANDLEEXISTS E_ACCESSDENIED 787 788/* 789 * Data is not yet available. 790 */ 791#ifndef E_PENDING 792#define E_PENDING 0x80070007L 793#endif 794 795#ifdef __cplusplus 796}; 797#endif 798 799#endif /* __DINPUT_INCLUDED__ */ 800 801/**************************************************************************** 802 * 803 * Definitions for non-IDirectInput (VJoyD) features defined more recently 804 * than the current sdk files 805 * 806 ****************************************************************************/ 807 808#ifdef _INC_MMSYSTEM 809#ifndef MMNOJOY 810 811#ifndef __VJOYDX_INCLUDED__ 812#define __VJOYDX_INCLUDED__ 813 814#ifdef __cplusplus 815extern "C" { 816#endif 817 818/* 819 * Flag to indicate that the dwReserved2 field of the JOYINFOEX structure 820 * contains mini-driver specific data to be passed by VJoyD to the mini- 821 * driver instead of doing a poll. 822 */ 823#define JOY_PASSDRIVERDATA 0x10000000l 824 825/* 826 * Informs the joystick driver that the configuration has been changed 827 * and should be reloaded from the registery. 828 * dwFlags is reserved and should be set to zero 829 */ 830WINMMAPI MMRESULT WINAPI joyConfigChanged( DWORD dwFlags ); 831 832/* 833 * Hardware Setting indicating that the device is a headtracker 834 */ 835#define JOY_HWS_ISHEADTRACKER 0x02000000l 836 837/* 838 * Hardware Setting indicating that the VxD is used to replace 839 * the standard analog polling 840 */ 841#define JOY_HWS_ISGAMEPORTDRIVER 0x04000000l 842 843#ifdef __cplusplus 844}; 845#endif 846 847#endif /* __VJOYDX_INCLUDED__ */ 848 849#endif /* not MMNOJOY */ 850#endif /* _INC_MMSYSTEM */ 851 852/**************************************************************************** 853 * 854 * Definitions for non-IDirectInput (VJoyD) features defined more recently 855 * than the current ddk files 856 * 857 ****************************************************************************/ 858 859#ifdef _INC_MMDDK 860#ifndef MMNOJOYDEV 861 862#ifndef __VJOYDXD_INCLUDED__ 863#define __VJOYDXD_INCLUDED__ 864/* 865 * Poll type in which the do_other field of the JOYOEMPOLLDATA 866 * structure contains mini-driver specific data passed from an app. 867 */ 868#define JOY_OEMPOLL_PASSDRIVERDATA 7 869 870#endif /* __VJOYDXD_INCLUDED__ */ 871 872#endif /* not MMNOJOYDEV */ 873#endif /* _INC_MMDDK */ 874