I'm having trouble setting up the DirectX callback event. This is the code that is "setting it up"
VB Code:
Public Function Init(frm As Form, hEventCallBack As Long) As Boolean 'On Error GoTo failed: Dim l As Long Dim DevProp As DIPROPLONG Dim DevInfo As DirectInputDeviceInstance8 Dim pBuffer(0 To 1) As DIDEVICEOBJECTDATA hEvent = DX.CreateEvent(frm) Debug.Print hEvent DIDevice.SetEventNotification hEvent Set DX = New DirectX8 Set DI = DX.DirectInputCreate Set DIDevice = DI.CreateDevice("GUID_SysKeyboard") DIDevice.SetCommonDataFormat DIFORMAT_KEYBOARD 'Can be changed, be if set to DISCL_EXCLUSIVE you may have trouble breaking! DIDevice.SetCooperativeLevel frm.hWnd, DISCL_BACKGROUND Or DISCL_NONEXCLUSIVE DevProp.lHow = DIPH_DEVICE DevProp.lData = 1 DIDevice.SetProperty DIPROP_BUFFERSIZE, DevProp DIDevice.Acquire Init = True bLoaded = True Exit Function failed: Init = False End Function
I have read the tutorial at directx4vb.com and I think that this how I'm supposed to do it!
NOTE: This code is in a class. Would that screw everything up?




Reply With Quote