Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- dim pIdi2 as LPDIRECTINPUT2A
- dim pDid2 as LPDIRECTINPUTDEVICE2A
- NOISYDEBUG printf(!"Trying dinput.\n")
- #define SHUT(X) cast(any ptr, X)
- CoInitialize(NULL)
- i = 1
- while TRUE
- select case i
- case 1: hr = CoCreateInstance(@CLSID_DirectInput, NULL, CLSCTX_INPROC_SERVER, @IID_IDirectInput2A, SHUT(@pIdi2))
- case 2: hr = IDirectInput2_CreateDevice(pIdi2, @GUID_SysKeyboard, SHUT(@pIdi2), SHUT(pIdi2))
- case 3: hr = IDirectInputDevice2_SetDataFormat(pDid2, @c_dfDIKeyboard)
- case 4: hr = IDirectInputDevice2_SetCooperativeLevel(pDid2, 0, DISCL_NONEXCLUSIVE or DISCL_BACKGROUND)
- case 5:
- case else: exit while
- end select
- i+=1
- if FAILED(hr) then
- NOISYDEBUG printf(!"pos: %d hr: %X\n", i, hr)
- if pIdi2 then IDirectInput2_Release(pIdi2)
- return FALSE
- end if
- wend
- if pIdi2 then IDirectInput2_Release(pIdi2)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement