I declared Direct3DX As D3DX8. For DirectInput I simply used this:
vb Code:
Public Direct_Input As DirectInput8
Public Keyboard_Device As DirectInputDevice8
Public Keyboard_State As DIKEYBOARDSTATE
Public Sub DirectInput_Initialize_Keyboard(Window As Form)
'Use in Form_Load to initialize DirectInput for Keyboard
Set Direct_Input = DX.DirectInputCreate
Set Keyboard_Device = Direct_Input.CreateDevice("GUID_SysKeyboard")
Keyboard_Device.SetCommonDataFormat DIFORMAT_KEYBOARD
Keyboard_Device.SetCooperativeLevel Window.hWnd, DISCL_BACKGROUND Or DISCL_NONEXCLUSIVE
Keyboard_Device.Acquire
Keyboard_Device.GetDeviceStateKeyboard Keyboard_State
End Sub
Public Function DirectInput_Key_State(Key_Code As Long) As Long
'Use during your game loop to check for keys pressed. DO NOT USE Keycodes.
'Only use DIK_ variables and the appropriate key.
Keyboard_Device.GetDeviceStateKeyboard Keyboard_State
DirectInput_Key_State = Keyboard_State.Key(Key_Code)
End Function