ref: 8f12e13c9d1485183666c71eeab428066f0077b6
dir: /QW/dxsdk/sdk/inc/dinput.h/
/**************************************************************************** * * Copyright (C) 1996 Microsoft Corporation. All Rights Reserved. * * File: dinput.h * Content: DirectInput include file * ****************************************************************************/ #ifndef __DINPUT_INCLUDED__ #define __DINPUT_INCLUDED__ #ifdef _WIN32 #define COM_NO_WINDOWS_H #include <objbase.h> #endif #ifdef __cplusplus extern "C" { #endif #define DIRECTINPUT_VERSION 0x0300 /**************************************************************************** * * Class IDs * ****************************************************************************/ DEFINE_GUID(CLSID_DirectInput, 0x25E609E0,0xB259,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); DEFINE_GUID(CLSID_DirectInputDevice,0x25E609E1,0xB259,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); /**************************************************************************** * * Interfaces * ****************************************************************************/ DEFINE_GUID(IID_IDirectInputA, 0x89521360,0xAA8A,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); DEFINE_GUID(IID_IDirectInputW, 0x89521361,0xAA8A,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); DEFINE_GUID(IID_IDirectInputDeviceA,0x5944E680,0xC92E,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); DEFINE_GUID(IID_IDirectInputDeviceW,0x5944E681,0xC92E,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); /**************************************************************************** * * Predefined object types * ****************************************************************************/ DEFINE_GUID(GUID_XAxis, 0xA36D02E0,0xC9F3,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); DEFINE_GUID(GUID_YAxis, 0xA36D02E1,0xC9F3,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); DEFINE_GUID(GUID_ZAxis, 0xA36D02E2,0xC9F3,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); DEFINE_GUID(GUID_RAxis, 0xA36D02E3,0xC9F3,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); DEFINE_GUID(GUID_UAxis, 0xA36D02E4,0xC9F3,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); DEFINE_GUID(GUID_VAxis, 0xA36D02E5,0xC9F3,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); DEFINE_GUID(GUID_Button, 0xA36D02F0,0xC9F3,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); DEFINE_GUID(GUID_Key, 0x55728220,0xD33C,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); DEFINE_GUID(GUID_POV, 0xA36D02F2,0xC9F3,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); /**************************************************************************** * * Predefined product GUIDs * ****************************************************************************/ DEFINE_GUID(GUID_SysMouse, 0x6F1D2B60,0xD5A0,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); DEFINE_GUID(GUID_SysKeyboard,0x6F1D2B61,0xD5A0,0x11CF,0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00); /**************************************************************************** * * Interfaces and Structures... * ****************************************************************************/ /**************************************************************************** * * IDirectInputDevice * ****************************************************************************/ #define DIDEVTYPE_DEVICE 1 #define DIDEVTYPE_MOUSE 2 #define DIDEVTYPE_KEYBOARD 3 #define DIDEVTYPE_JOYSTICK 4 #define DIDEVTYPEMOUSE_UNKNOWN 1 #define DIDEVTYPEMOUSE_TRADITIONAL 2 #define DIDEVTYPEMOUSE_FINGERSTICK 3 #define DIDEVTYPEMOUSE_TOUCHPAD 4 #define DIDEVTYPEMOUSE_TRACKBALL 5 #define DIDEVTYPEKEYBOARD_PCXT 1 #define DIDEVTYPEKEYBOARD_OLIVETTI 2 #define DIDEVTYPEKEYBOARD_PCAT 3 #define DIDEVTYPEKEYBOARD_PCENH 4 #define DIDEVTYPEKEYBOARD_NOKIA1050 5 #define DIDEVTYPEKEYBOARD_NOKIA9140 6 #define DIDEVTYPEKEYBOARD_NEC98 7 #define DIDEVTYPEKEYBOARD_NEC98LAPTOP 8 #define DIDEVTYPEKEYBOARD_NEC98106 9 #define DIDEVTYPEKEYBOARD_JAPAN106 10 #define DIDEVTYPEKEYBOARD_JAPANAX 11 #define DIDEVTYPEKEYBOARD_J3100 12 #define GET_DIDEVICE_TYPE(dwDevType) LOBYTE(dwDevType) #define GET_DIDEVICE_SUBTYPE(dwDevType) HIBYTE(dwDevType) typedef struct _DIDEVCAPS { DWORD dwSize; DWORD dwFlags; DWORD dwDevType; DWORD dwAxes; DWORD dwButtons; DWORD dwPOVs; } DIDEVCAPS, *LPDIDEVCAPS; #define DIDC_ATTACHED 0x00000001 #define DIDC_POLLEDDEVICE 0x00000002 #define DIDFT_ALL 0x00000000 #define DIDFT_RELAXIS 0x00000001 #define DIDFT_ABSAXIS 0x00000002 #define DIDFT_AXIS 0x00000003 #define DIDFT_PSHBUTTON 0x00000004 #define DIDFT_TGLBUTTON 0x00000008 #define DIDFT_BUTTON 0x0000000C #define DIDFT_POV 0x00000010 #define DIDFT_ANYINSTANCE 0x0000FF00 #define DIDFT_MAKEINSTANCE(n) ((BYTE)(n) << 8) #define DIDFT_GETTYPE(n) LOBYTE(n) #define DIDFT_GETINSTANCE(n) HIBYTE(n) typedef struct _DIOBJECTDATAFORMAT { const GUID *pguid; DWORD dwOfs; DWORD dwType; DWORD dwFlags; } DIOBJECTDATAFORMAT, *LPDIOBJECTDATAFORMAT; typedef const DIOBJECTDATAFORMAT *LPCDIOBJECTDATAFORMAT; typedef struct _DIDATAFORMAT { DWORD dwSize; DWORD dwObjSize; DWORD dwFlags; DWORD dwDataSize; DWORD dwNumObjs; LPDIOBJECTDATAFORMAT rgodf; } DIDATAFORMAT, *LPDIDATAFORMAT; typedef const DIDATAFORMAT *LPCDIDATAFORMAT; #define DIDF_ABSAXIS 0x00000001 #define DIDF_RELAXIS 0x00000002 extern const DIDATAFORMAT c_dfDIMouse; extern const DIDATAFORMAT c_dfDIKeyboard; typedef struct DIDEVICEOBJECTINSTANCEA { DWORD dwSize; GUID guidType; DWORD dwOfs; DWORD dwType; DWORD dwFlags; CHAR tszName[MAX_PATH]; } DIDEVICEOBJECTINSTANCEA, *LPDIDEVICEOBJECTINSTANCEA; typedef struct DIDEVICEOBJECTINSTANCEW { DWORD dwSize; GUID guidType; DWORD dwOfs; DWORD dwType; DWORD dwFlags; WCHAR tszName[MAX_PATH]; } DIDEVICEOBJECTINSTANCEW, *LPDIDEVICEOBJECTINSTANCEW; #ifdef UNICODE typedef DIDEVICEOBJECTINSTANCEW DIDEVICEOBJECTINSTANCE; typedef LPDIDEVICEOBJECTINSTANCEW LPDIDEVICEOBJECTINSTANCE; #else typedef DIDEVICEOBJECTINSTANCEA DIDEVICEOBJECTINSTANCE; typedef LPDIDEVICEOBJECTINSTANCEA LPDIDEVICEOBJECTINSTANCE; #endif // UNICODE typedef const DIDEVICEOBJECTINSTANCEA *LPCDIDEVICEOBJECTINSTANCEA; typedef const DIDEVICEOBJECTINSTANCEW *LPCDIDEVICEOBJECTINSTANCEW; typedef const DIDEVICEOBJECTINSTANCE *LPCDIDEVICEOBJECTINSTANCE; typedef BOOL (FAR PASCAL * LPDIENUMDEVICEOBJECTSCALLBACKA)(LPCDIDEVICEOBJECTINSTANCEA, LPVOID); typedef BOOL (FAR PASCAL * LPDIENUMDEVICEOBJECTSCALLBACKW)(LPCDIDEVICEOBJECTINSTANCEW, LPVOID); #ifdef UNICODE #define LPDIENUMDEVICEOBJECTSCALLBACK LPDIENUMDEVICEOBJECTSCALLBACKW #else #define LPDIENUMDEVICEOBJECTSCALLBACK LPDIENUMDEVICEOBJECTSCALLBACKA #endif // !UNICODE typedef struct DIPROPHEADER { DWORD dwSize; DWORD dwHeaderSize; DWORD dwObj; DWORD dwHow; } DIPROPHEADER, *LPDIPROPHEADER; typedef const DIPROPHEADER *LPCDIPROPHEADER; #define DIPH_DEVICE 0 #define DIPH_BYOFFSET 1 #define DIPH_BYID 2 typedef struct DIPROPDWORD { DIPROPHEADER diph; DWORD dwData; } DIPROPDWORD, *LPDIPROPDWORD; typedef const DIPROPDWORD *LPCDIPROPDWORD; typedef struct DIPROPRANGE { DIPROPHEADER diph; LONG lMin; LONG lMax; } DIPROPRANGE, *LPDIPROPRANGE; typedef const DIPROPRANGE *LPCDIPROPRANGE; #define DIPROPRANGE_NOMIN ((LONG)0x80000000) #define DIPROPRANGE_NOMAX ((LONG)0x7FFFFFFF) #ifdef __cplusplus #define MAKEDIPROP(prop) (*(const GUID *)(prop)) #else #define MAKEDIPROP(prop) ((REFGUID)(prop)) #endif #define DIPROP_BUFFERSIZE MAKEDIPROP(1) #define DIPROP_AXISMODE MAKEDIPROP(2) #define DIPROPAXISMODE_ABS 0 #define DIPROPAXISMODE_REL 1 #define DIPROP_GRANULARITY MAKEDIPROP(3) #define DIPROP_RANGE MAKEDIPROP(4) typedef struct DIDEVICEOBJECTDATA { DWORD dwOfs; DWORD dwData; DWORD dwTimeStamp; DWORD dwSequence; } DIDEVICEOBJECTDATA, *LPDIDEVICEOBJECTDATA; #define DIGDD_PEEK 0x00000001 #define DISEQUENCE_COMPARE(dwSequence1, cmp, dwSequence2) \ ((int)((dwSequence1) - (dwSequence2)) cmp 0) #define DISCL_EXCLUSIVE 0x00000001 #define DISCL_NONEXCLUSIVE 0x00000002 #define DISCL_FOREGROUND 0x00000004 #define DISCL_BACKGROUND 0x00000008 typedef struct DIDEVICEINSTANCEA { DWORD dwSize; GUID guidInstance; GUID guidProduct; DWORD dwDevType; CHAR tszInstanceName[MAX_PATH]; CHAR tszProductName[MAX_PATH]; } DIDEVICEINSTANCEA, *LPDIDEVICEINSTANCEA; typedef struct DIDEVICEINSTANCEW { DWORD dwSize; GUID guidInstance; GUID guidProduct; DWORD dwDevType; WCHAR tszInstanceName[MAX_PATH]; WCHAR tszProductName[MAX_PATH]; } DIDEVICEINSTANCEW, *LPDIDEVICEINSTANCEW; #ifdef UNICODE typedef DIDEVICEINSTANCEW DIDEVICEINSTANCE; typedef LPDIDEVICEINSTANCEW LPDIDEVICEINSTANCE; #else typedef DIDEVICEINSTANCEA DIDEVICEINSTANCE; typedef LPDIDEVICEINSTANCEA LPDIDEVICEINSTANCE; #endif // UNICODE typedef const DIDEVICEINSTANCEA *LPCDIDEVICEINSTANCEA; typedef const DIDEVICEINSTANCEW *LPCDIDEVICEINSTANCEW; typedef const DIDEVICEINSTANCE *LPCDIDEVICEINSTANCE; #undef INTERFACE #define INTERFACE IDirectInputDeviceW DECLARE_INTERFACE_(IDirectInputDeviceW, IUnknown) { /*** IUnknown methods ***/ STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE; STDMETHOD_(ULONG,AddRef)(THIS) PURE; STDMETHOD_(ULONG,Release)(THIS) PURE; /*** IDirectInputDeviceW methods ***/ STDMETHOD(GetCapabilities)(THIS_ LPDIDEVCAPS) PURE; STDMETHOD(EnumObjects)(THIS_ LPDIENUMDEVICEOBJECTSCALLBACKW,LPVOID,DWORD) PURE; STDMETHOD(GetProperty)(THIS_ REFGUID,LPDIPROPHEADER) PURE; STDMETHOD(SetProperty)(THIS_ REFGUID,LPCDIPROPHEADER) PURE; STDMETHOD(Acquire)(THIS) PURE; STDMETHOD(Unacquire)(THIS) PURE; STDMETHOD(GetDeviceState)(THIS_ DWORD,LPVOID) PURE; STDMETHOD(GetDeviceData)(THIS_ DWORD,LPDIDEVICEOBJECTDATA,LPDWORD,DWORD) PURE; STDMETHOD(SetDataFormat)(THIS_ LPCDIDATAFORMAT) PURE; STDMETHOD(SetEventNotification)(THIS_ HANDLE) PURE; STDMETHOD(SetCooperativeLevel)(THIS_ HWND,DWORD) PURE; STDMETHOD(GetObjectInfo)(THIS_ LPDIDEVICEOBJECTINSTANCEW,DWORD,DWORD) PURE; STDMETHOD(GetDeviceInfo)(THIS_ LPDIDEVICEINSTANCEW) PURE; STDMETHOD(RunControlPanel)(THIS_ HWND,DWORD) PURE; STDMETHOD(Initialize)(THIS_ HINSTANCE,DWORD,REFGUID) PURE; }; typedef struct IDirectInputDeviceW *LPDIRECTINPUTDEVICEW; #undef INTERFACE #define INTERFACE IDirectInputDeviceA DECLARE_INTERFACE_(IDirectInputDeviceA, IUnknown) { /*** IUnknown methods ***/ STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE; STDMETHOD_(ULONG,AddRef)(THIS) PURE; STDMETHOD_(ULONG,Release)(THIS) PURE; /*** IDirectInputDeviceA methods ***/ STDMETHOD(GetCapabilities)(THIS_ LPDIDEVCAPS) PURE; STDMETHOD(EnumObjects)(THIS_ LPDIENUMDEVICEOBJECTSCALLBACKA,LPVOID,DWORD) PURE; STDMETHOD(GetProperty)(THIS_ REFGUID,LPDIPROPHEADER) PURE; STDMETHOD(SetProperty)(THIS_ REFGUID,LPCDIPROPHEADER) PURE; STDMETHOD(Acquire)(THIS) PURE; STDMETHOD(Unacquire)(THIS) PURE; STDMETHOD(GetDeviceState)(THIS_ DWORD,LPVOID) PURE; STDMETHOD(GetDeviceData)(THIS_ DWORD,LPDIDEVICEOBJECTDATA,LPDWORD,DWORD) PURE; STDMETHOD(SetDataFormat)(THIS_ LPCDIDATAFORMAT) PURE; STDMETHOD(SetEventNotification)(THIS_ HANDLE) PURE; STDMETHOD(SetCooperativeLevel)(THIS_ HWND,DWORD) PURE; STDMETHOD(GetObjectInfo)(THIS_ LPDIDEVICEOBJECTINSTANCEA,DWORD,DWORD) PURE; STDMETHOD(GetDeviceInfo)(THIS_ LPDIDEVICEINSTANCEA) PURE; STDMETHOD(RunControlPanel)(THIS_ HWND,DWORD) PURE; STDMETHOD(Initialize)(THIS_ HINSTANCE,DWORD,REFGUID) PURE; }; typedef struct IDirectInputDeviceA *LPDIRECTINPUTDEVICEA; #ifdef UNICODE #define IID_IDirectInputDevice IID_IDirectInputDeviceW #define IDirectInputDevice IDirectInputDeviceW #define IDirectInputDeviceVtbl IDirectInputDeviceWVtbl #else #define IID_IDirectInputDevice IID_IDirectInputDeviceA #define IDirectInputDevice IDirectInputDeviceA #define IDirectInputDeviceVtbl IDirectInputDeviceAVtbl #endif typedef struct IDirectInputDevice *LPDIRECTINPUTDEVICE; #if !defined(__cplusplus) || defined(CINTERFACE) #define IDirectInputDevice_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) #define IDirectInputDevice_AddRef(p) (p)->lpVtbl->AddRef(p) #define IDirectInputDevice_Release(p) (p)->lpVtbl->Release(p) #define IDirectInputDevice_GetCapabilities(p,a) (p)->lpVtbl->GetCapabilities(p,a) #define IDirectInputDevice_EnumObjects(p,a,b,c) (p)->lpVtbl->EnumObjects(p,a,b,c) #define IDirectInputDevice_GetProperty(p,a,b) (p)->lpVtbl->GetProperty(p,a,b) #define IDirectInputDevice_SetProperty(p,a,b) (p)->lpVtbl->SetProperty(p,a,b) #define IDirectInputDevice_Acquire(p) (p)->lpVtbl->Acquire(p) #define IDirectInputDevice_Unacquire(p) (p)->lpVtbl->Unacquire(p) #define IDirectInputDevice_GetDeviceState(p,a,b) (p)->lpVtbl->GetDeviceState(p,a,b) #define IDirectInputDevice_GetDeviceData(p,a,b,c,d) (p)->lpVtbl->GetDeviceData(p,a,b,c,d) #define IDirectInputDevice_SetDataFormat(p,a) (p)->lpVtbl->SetDataFormat(p,a) #define IDirectInputDevice_SetEventNotification(p,a) (p)->lpVtbl->SetEventNotification(p,a) #define IDirectInputDevice_SetCooperativeLevel(p,a,b) (p)->lpVtbl->SetCooperativeLevel(p,a,b) #define IDirectInputDevice_GetObjectInfo(p,a,b,c) (p)->lpVtbl->GetObjectInfo(p,a,b,c) #define IDirectInputDevice_GetDeviceInfo(p,a) (p)->lpVtbl->GetDeviceInfo(p,a) #define IDirectInputDevice_RunControlPanel(p,a,b) (p)->lpVtbl->RunControlPanel(p,a,b) #define IDirectInputDevice_Initialize(p,a,b,c) (p)->lpVtbl->Initialize(p,a,b,c) #endif /**************************************************************************** * * Mouse * ****************************************************************************/ typedef struct _DIMOUSESTATE { LONG lX; LONG lY; LONG lZ; BYTE rgbButtons[4]; } DIMOUSESTATE, *LPDIMOUSESTATE; #define DIMOFS_X FIELD_OFFSET(DIMOUSESTATE, lX) #define DIMOFS_Y FIELD_OFFSET(DIMOUSESTATE, lY) #define DIMOFS_Z FIELD_OFFSET(DIMOUSESTATE, lZ) #define DIMOFS_BUTTON0 (FIELD_OFFSET(DIMOUSESTATE, rgbButtons) + 0) #define DIMOFS_BUTTON1 (FIELD_OFFSET(DIMOUSESTATE, rgbButtons) + 1) #define DIMOFS_BUTTON2 (FIELD_OFFSET(DIMOUSESTATE, rgbButtons) + 2) #define DIMOFS_BUTTON3 (FIELD_OFFSET(DIMOUSESTATE, rgbButtons) + 3) /**************************************************************************** * * Keyboard * ****************************************************************************/ /**************************************************************************** * * DirectInput keyboard scan codes * ****************************************************************************/ #define DIK_ESCAPE 0x01 #define DIK_1 0x02 #define DIK_2 0x03 #define DIK_3 0x04 #define DIK_4 0x05 #define DIK_5 0x06 #define DIK_6 0x07 #define DIK_7 0x08 #define DIK_8 0x09 #define DIK_9 0x0A #define DIK_0 0x0B #define DIK_MINUS 0x0C /* - on main keyboard */ #define DIK_EQUALS 0x0D #define DIK_BACK 0x0E /* backspace */ #define DIK_TAB 0x0F #define DIK_Q 0x10 #define DIK_W 0x11 #define DIK_E 0x12 #define DIK_R 0x13 #define DIK_T 0x14 #define DIK_Y 0x15 #define DIK_U 0x16 #define DIK_I 0x17 #define DIK_O 0x18 #define DIK_P 0x19 #define DIK_LBRACKET 0x1A #define DIK_RBRACKET 0x1B #define DIK_RETURN 0x1C /* Enter on main keyboard */ #define DIK_LCONTROL 0x1D #define DIK_A 0x1E #define DIK_S 0x1F #define DIK_D 0x20 #define DIK_F 0x21 #define DIK_G 0x22 #define DIK_H 0x23 #define DIK_J 0x24 #define DIK_K 0x25 #define DIK_L 0x26 #define DIK_SEMICOLON 0x27 #define DIK_APOSTROPHE 0x28 #define DIK_GRAVE 0x29 /* accent grave */ #define DIK_LSHIFT 0x2A #define DIK_BACKSLASH 0x2B #define DIK_Z 0x2C #define DIK_X 0x2D #define DIK_C 0x2E #define DIK_V 0x2F #define DIK_B 0x30 #define DIK_N 0x31 #define DIK_M 0x32 #define DIK_COMMA 0x33 #define DIK_PERIOD 0x34 /* . on main keyboard */ #define DIK_SLASH 0x35 /* / on main keyboard */ #define DIK_RSHIFT 0x36 #define DIK_MULTIPLY 0x37 /* * on numeric keypad */ #define DIK_LMENU 0x38 /* left Alt */ #define DIK_SPACE 0x39 #define DIK_CAPITAL 0x3A #define DIK_F1 0x3B #define DIK_F2 0x3C #define DIK_F3 0x3D #define DIK_F4 0x3E #define DIK_F5 0x3F #define DIK_F6 0x40 #define DIK_F7 0x41 #define DIK_F8 0x42 #define DIK_F9 0x43 #define DIK_F10 0x44 #define DIK_NUMLOCK 0x45 #define DIK_SCROLL 0x46 /* Scroll Lock */ #define DIK_NUMPAD7 0x47 #define DIK_NUMPAD8 0x48 #define DIK_NUMPAD9 0x49 #define DIK_SUBTRACT 0x4A /* - on numeric keypad */ #define DIK_NUMPAD4 0x4B #define DIK_NUMPAD5 0x4C #define DIK_NUMPAD6 0x4D #define DIK_ADD 0x4E /* + on numeric keypad */ #define DIK_NUMPAD1 0x4F #define DIK_NUMPAD2 0x50 #define DIK_NUMPAD3 0x51 #define DIK_NUMPAD0 0x52 #define DIK_DECIMAL 0x53 /* . on numeric keypad */ #define DIK_F11 0x57 #define DIK_F12 0x58 #define DIK_F13 0x64 /* (NEC PC98) */ #define DIK_F14 0x65 /* (NEC PC98) */ #define DIK_F15 0x66 /* (NEC PC98) */ #define DIK_KANA 0x70 /* (Japanese keyboard) */ #define DIK_CONVERT 0x79 /* (Japanese keyboard) */ #define DIK_NOCONVERT 0x7B /* (Japanese keyboard) */ #define DIK_YEN 0x7D /* (Japanese keyboard) */ #define DIK_NUMPADEQUALS 0x8D /* = on numeric keypad (NEC PC98) */ #define DIK_CIRCUMFLEX 0x90 /* (Japanese keyboard) */ #define DIK_AT 0x91 /* (NEC PC98) */ #define DIK_COLON 0x92 /* (NEC PC98) */ #define DIK_UNDERLINE 0x93 /* (NEC PC98) */ #define DIK_KANJI 0x94 /* (Japanese keyboard) */ #define DIK_STOP 0x95 /* (NEC PC98) */ #define DIK_AX 0x96 /* (Japan AX) */ #define DIK_UNLABELED 0x97 /* (J3100) */ #define DIK_NUMPADENTER 0x9C /* Enter on numeric keypad */ #define DIK_RCONTROL 0x9D #define DIK_NUMPADCOMMA 0xB3 /* , on numeric keypad (NEC PC98) */ #define DIK_DIVIDE 0xB5 /* / on numeric keypad */ #define DIK_SYSRQ 0xB7 #define DIK_RMENU 0xB8 /* right Alt */ #define DIK_HOME 0xC7 /* Home on arrow keypad */ #define DIK_UP 0xC8 /* UpArrow on arrow keypad */ #define DIK_PRIOR 0xC9 /* PgUp on arrow keypad */ #define DIK_LEFT 0xCB /* LeftArrow on arrow keypad */ #define DIK_RIGHT 0xCD /* RightArrow on arrow keypad */ #define DIK_END 0xCF /* End on arrow keypad */ #define DIK_DOWN 0xD0 /* DownArrow on arrow keypad */ #define DIK_NEXT 0xD1 /* PgDn on arrow keypad */ #define DIK_INSERT 0xD2 /* Insert on arrow keypad */ #define DIK_DELETE 0xD3 /* Delete on arrow keypad */ #define DIK_LWIN 0xDB /* Left Windows key */ #define DIK_RWIN 0xDC /* Right Windows key */ #define DIK_APPS 0xDD /* AppMenu key */ /* * Alternate names for keys, to facilitate transition from DOS. */ #define DIK_BACKSPACE DIK_BACK /* backspace */ #define DIK_NUMPADSTAR DIK_MULTIPLY /* * on numeric keypad */ #define DIK_LALT DIK_LMENU /* left Alt */ #define DIK_CAPSLOCK DIK_CAPITAL /* CapsLock */ #define DIK_NUMPADMINUS DIK_SUBTRACT /* - on numeric keypad */ #define DIK_NUMPADPLUS DIK_ADD /* + on numeric keypad */ #define DIK_NUMPADPERIOD DIK_DECIMAL /* . on numeric keypad */ #define DIK_NUMPADSLASH DIK_DIVIDE /* / on numeric keypad */ #define DIK_RALT DIK_RMENU /* right Alt */ #define DIK_UPARROW DIK_UP /* UpArrow on arrow keypad */ #define DIK_PGUP DIK_PRIOR /* PgUp on arrow keypad */ #define DIK_LEFTARROW DIK_LEFT /* LeftArrow on arrow keypad */ #define DIK_RIGHTARROW DIK_RIGHT /* RightArrow on arrow keypad */ #define DIK_DOWNARROW DIK_DOWN /* DownArrow on arrow keypad */ #define DIK_PGDN DIK_NEXT /* PgDn on arrow keypad */ /**************************************************************************** * * IDirectInput * ****************************************************************************/ #define DIENUM_STOP 0 #define DIENUM_CONTINUE 1 typedef BOOL (FAR PASCAL * LPDIENUMDEVICESCALLBACKA)(LPCDIDEVICEINSTANCEA, LPVOID); typedef BOOL (FAR PASCAL * LPDIENUMDEVICESCALLBACKW)(LPCDIDEVICEINSTANCEW, LPVOID); #ifdef UNICODE #define LPDIENUMDEVICESCALLBACK LPDIENUMDEVICESCALLBACKW #else #define LPDIENUMDEVICESCALLBACK LPDIENUMDEVICESCALLBACKA #endif // !UNICODE #define DIEDFL_ALLDEVICES 0x00000000 #define DIEDFL_ATTACHEDONLY 0x00000001 #undef INTERFACE #define INTERFACE IDirectInputW DECLARE_INTERFACE_(IDirectInputW, IUnknown) { /*** IUnknown methods ***/ STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE; STDMETHOD_(ULONG,AddRef)(THIS) PURE; STDMETHOD_(ULONG,Release)(THIS) PURE; /*** IDirectInputW methods ***/ STDMETHOD(CreateDevice)(THIS_ REFGUID,LPDIRECTINPUTDEVICEW *,LPUNKNOWN) PURE; STDMETHOD(EnumDevices)(THIS_ DWORD,LPDIENUMDEVICESCALLBACKW,LPVOID,DWORD) PURE; STDMETHOD(GetDeviceStatus)(THIS_ REFGUID) PURE; STDMETHOD(RunControlPanel)(THIS_ HWND,DWORD) PURE; STDMETHOD(Initialize)(THIS_ HINSTANCE,DWORD) PURE; }; typedef struct IDirectInputW *LPDIRECTINPUTW; #undef INTERFACE #define INTERFACE IDirectInputA DECLARE_INTERFACE_(IDirectInputA, IUnknown) { /*** IUnknown methods ***/ STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE; STDMETHOD_(ULONG,AddRef)(THIS) PURE; STDMETHOD_(ULONG,Release)(THIS) PURE; /*** IDirectInputA methods ***/ STDMETHOD(CreateDevice)(THIS_ REFGUID,LPDIRECTINPUTDEVICEA *,LPUNKNOWN) PURE; STDMETHOD(EnumDevices)(THIS_ DWORD,LPDIENUMDEVICESCALLBACKA,LPVOID,DWORD) PURE; STDMETHOD(GetDeviceStatus)(THIS_ REFGUID) PURE; STDMETHOD(RunControlPanel)(THIS_ HWND,DWORD) PURE; STDMETHOD(Initialize)(THIS_ HINSTANCE,DWORD) PURE; }; typedef struct IDirectInputA *LPDIRECTINPUTA; #ifdef UNICODE #define IID_IDirectInput IID_IDirectInputW #define IDirectInput IDirectInputW #define IDirectInputVtbl IDirectInputWVtbl #else #define IID_IDirectInput IID_IDirectInputA #define IDirectInput IDirectInputA #define IDirectInputVtbl IDirectInputAVtbl #endif typedef struct IDirectInput *LPDIRECTINPUT; #if !defined(__cplusplus) || defined(CINTERFACE) #define IDirectInput_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) #define IDirectInput_AddRef(p) (p)->lpVtbl->AddRef(p) #define IDirectInput_Release(p) (p)->lpVtbl->Release(p) #define IDirectInput_CreateDevice(p,a,b,c) (p)->lpVtbl->CreateDevice(p,a,b,c) #define IDirectInput_EnumDevices(p,a,b,c,d) (p)->lpVtbl->EnumDevices(p,a,b,c,d) #define IDirectInput_GetDeviceStatus(p,a) (p)->lpVtbl->GetDeviceStatus(p,a) #define IDirectInput_RunControlPanel(p,a,b) (p)->lpVtbl->RunControlPanel(p,a,b) #define IDirectInput_Initialize(p,a,b) (p)->lpVtbl->Initialize(p,a,b) #endif extern HRESULT WINAPI DirectInputCreateA(HINSTANCE hinst, DWORD dwVersion, LPDIRECTINPUTA *ppDI, LPUNKNOWN punkOuter); extern HRESULT WINAPI DirectInputCreateW(HINSTANCE hinst, DWORD dwVersion, LPDIRECTINPUTW *ppDI, LPUNKNOWN punkOuter); #ifdef UNICODE #define DirectInputCreate DirectInputCreateW #else #define DirectInputCreate DirectInputCreateA #endif // !UNICODE /**************************************************************************** * * Return Codes * ****************************************************************************/ /* * The operation completed successfully. */ #define DI_OK S_OK /* * The device exists but is not currently attached. */ #define DI_NOTATTACHED S_FALSE /* * The device buffer overflowed; some input was lost. */ #define DI_BUFFEROVERFLOW S_FALSE /* * The change in device properties had no effect. */ #define DI_PROPNOEFFECT S_FALSE /* * The device is a polled device. As a result, device buffering * will not collect any data and event notifications will not be * signalled until GetDeviceState is called. */ #define DI_POLLEDDEVICE ((HRESULT)0x00000002L) /* * The application requires a newer version of DirectInput. */ #define DIERR_OLDDIRECTINPUTVERSION \ MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_OLD_WIN_VERSION) /* * The application was written for an unsupported prerelease version * of DirectInput. */ #define DIERR_BETADIRECTINPUTVERSION \ MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_RMODE_APP) /* * The object could not be created due to an incompatible driver version * or mismatched or incomplete driver components. */ #define DIERR_BADDRIVERVER \ MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_BAD_DRIVER_LEVEL) /* * The device or device instance is not registered with DirectInput. */ #define DIERR_DEVICENOTREG REGDB_E_CLASSNOTREG /* * The requested object does not exist. */ #define DIERR_OBJECTNOTFOUND \ MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_FILE_NOT_FOUND) /* * An invalid parameter was passed to the returning function, * or the object was not in a state that admitted the function * to be called. */ #define DIERR_INVALIDPARAM E_INVALIDARG /* * The specified interface is not supported by the object */ #define DIERR_NOINTERFACE E_NOINTERFACE /* * An undetermined error occured inside the DInput subsystem */ #define DIERR_GENERIC E_FAIL /* * The DInput subsystem couldn't allocate sufficient memory to complete the * caller's request. */ #define DIERR_OUTOFMEMORY E_OUTOFMEMORY /* * The function called is not supported at this time */ #define DIERR_UNSUPPORTED E_NOTIMPL /* * This object has not been initialized */ #define DIERR_NOTINITIALIZED \ MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_NOT_READY) /* * This object is already initialized */ #define DIERR_ALREADYINITIALIZED \ MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_ALREADY_INITIALIZED) /* * This object does not support aggregation */ #define DIERR_NOAGGREGATION CLASS_E_NOAGGREGATION /* * Another app has a higher priority level, preventing this call from * succeeding. */ #define DIERR_OTHERAPPHASPRIO E_ACCESSDENIED /* * Access to the input device has been lost. It must be re-acquired. */ #define DIERR_INPUTLOST \ MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_READ_FAULT) /* * The operation cannot be performed while the device is acquired. */ #define DIERR_ACQUIRED \ MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_BUSY) /* * The operation cannot be performed unless the device is acquired. */ #define DIERR_NOTACQUIRED \ MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_INVALID_ACCESS) /* * The specified property cannot be changed. */ #define DIERR_READONLY E_ACCESSDENIED /* * The device already has an event notification associated with it. */ #define DIERR_HANDLEEXISTS E_ACCESSDENIED /* * Data is not yet available. */ #ifndef E_PENDING #define E_PENDING 0x80070007L #endif #ifdef __cplusplus }; #endif #endif /* __DINPUT_INCLUDED__ */ /**************************************************************************** * * Definitions for non-IDirectInput (VJoyD) features defined more recently * than the current sdk files * ****************************************************************************/ #ifdef _INC_MMSYSTEM #ifndef MMNOJOY #ifndef __VJOYDX_INCLUDED__ #define __VJOYDX_INCLUDED__ #ifdef __cplusplus extern "C" { #endif /* * Flag to indicate that the dwReserved2 field of the JOYINFOEX structure * contains mini-driver specific data to be passed by VJoyD to the mini- * driver instead of doing a poll. */ #define JOY_PASSDRIVERDATA 0x10000000l /* * Informs the joystick driver that the configuration has been changed * and should be reloaded from the registery. * dwFlags is reserved and should be set to zero */ WINMMAPI MMRESULT WINAPI joyConfigChanged( DWORD dwFlags ); /* * Hardware Setting indicating that the device is a headtracker */ #define JOY_HWS_ISHEADTRACKER 0x02000000l /* * Hardware Setting indicating that the VxD is used to replace * the standard analog polling */ #define JOY_HWS_ISGAMEPORTDRIVER 0x04000000l #ifdef __cplusplus }; #endif #endif /* __VJOYDX_INCLUDED__ */ #endif /* not MMNOJOY */ #endif /* _INC_MMSYSTEM */ /**************************************************************************** * * Definitions for non-IDirectInput (VJoyD) features defined more recently * than the current ddk files * ****************************************************************************/ #ifdef _INC_MMDDK #ifndef MMNOJOYDEV #ifndef __VJOYDXD_INCLUDED__ #define __VJOYDXD_INCLUDED__ /* * Poll type in which the do_other field of the JOYOEMPOLLDATA * structure contains mini-driver specific data passed from an app. */ #define JOY_OEMPOLL_PASSDRIVERDATA 7 #endif /* __VJOYDXD_INCLUDED__ */ #endif /* not MMNOJOYDEV */ #endif /* _INC_MMDDK */