I declared Direct3DX As D3DX8. For DirectInput I simply used this:

vb Code:
  1. Public Direct_Input As DirectInput8
  2. Public Keyboard_Device As DirectInputDevice8
  3. Public Keyboard_State As DIKEYBOARDSTATE
  4.  
  5. Public Sub DirectInput_Initialize_Keyboard(Window As Form)
  6.    
  7.     'Use in Form_Load to initialize DirectInput for Keyboard
  8.  
  9.     Set Direct_Input = DX.DirectInputCreate
  10.     Set Keyboard_Device = Direct_Input.CreateDevice("GUID_SysKeyboard")
  11.     Keyboard_Device.SetCommonDataFormat DIFORMAT_KEYBOARD
  12.     Keyboard_Device.SetCooperativeLevel Window.hWnd, DISCL_BACKGROUND Or DISCL_NONEXCLUSIVE
  13.     Keyboard_Device.Acquire
  14.     Keyboard_Device.GetDeviceStateKeyboard Keyboard_State
  15.  
  16. End Sub
  17.  
  18. Public Function DirectInput_Key_State(Key_Code As Long) As Long
  19.    
  20.     'Use during your game loop to check for keys pressed. DO NOT USE Keycodes.
  21.     'Only use DIK_ variables and the appropriate key.
  22.     Keyboard_Device.GetDeviceStateKeyboard Keyboard_State
  23.    
  24.     DirectInput_Key_State = Keyboard_State.Key(Key_Code)
  25.  
  26. End Function