Advertisement
Guest User

Untitled

a guest
Mar 30th, 2018
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.       dim pIdi2 as LPDIRECTINPUT2A
  2.       dim pDid2 as LPDIRECTINPUTDEVICE2A
  3.       NOISYDEBUG printf(!"Trying dinput.\n")
  4.      
  5.       #define SHUT(X) cast(any ptr, X)
  6.      
  7.       CoInitialize(NULL)
  8.       i = 1
  9.       while TRUE
  10.         select case i
  11.           case  1: hr = CoCreateInstance(@CLSID_DirectInput, NULL, CLSCTX_INPROC_SERVER, @IID_IDirectInput2A, SHUT(@pIdi2))
  12.           case  2: hr = IDirectInput2_CreateDevice(pIdi2, @GUID_SysKeyboard, SHUT(@pIdi2), SHUT(pIdi2))
  13.           case  3: hr = IDirectInputDevice2_SetDataFormat(pDid2, @c_dfDIKeyboard)
  14.           case  4: hr = IDirectInputDevice2_SetCooperativeLevel(pDid2, 0, DISCL_NONEXCLUSIVE or DISCL_BACKGROUND)
  15.           case  5:
  16.           case else: exit while
  17.         end select
  18.         i+=1
  19.         if FAILED(hr) then
  20.           NOISYDEBUG printf(!"pos: %d hr: %X\n", i, hr)
  21.           if pIdi2 then IDirectInput2_Release(pIdi2)
  22.           return FALSE
  23.         end if
  24.       wend
  25.      
  26.      
  27.       if pIdi2 then IDirectInput2_Release(pIdi2)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement