Results 1 to 1 of 1

Thread: Setting CallBack in DirectX (Setting Up Event Based!)

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Apr 2002
    Location
    Toronto, Ontario
    Posts
    280

    Setting CallBack in DirectX (Setting Up Event Based!)

    I'm having trouble setting up the DirectX callback event. This is the code that is "setting it up"

    VB Code:
    1. Public Function Init(frm As Form, hEventCallBack As Long) As Boolean
    2.     'On Error GoTo failed:
    3.    
    4.     Dim l As Long
    5.     Dim DevProp As DIPROPLONG
    6.     Dim DevInfo As DirectInputDeviceInstance8
    7.     Dim pBuffer(0 To 1) As DIDEVICEOBJECTDATA
    8.    
    9.     hEvent = DX.CreateEvent(frm)
    10.     Debug.Print hEvent
    11.     DIDevice.SetEventNotification hEvent
    12.    
    13.     Set DX = New DirectX8
    14.    
    15.     Set DI = DX.DirectInputCreate
    16.     Set DIDevice = DI.CreateDevice("GUID_SysKeyboard")
    17.    
    18.     DIDevice.SetCommonDataFormat DIFORMAT_KEYBOARD
    19.    
    20.     'Can be changed, be if set to DISCL_EXCLUSIVE you may have trouble breaking!
    21.     DIDevice.SetCooperativeLevel frm.hWnd, DISCL_BACKGROUND Or DISCL_NONEXCLUSIVE
    22.    
    23.     DevProp.lHow = DIPH_DEVICE
    24.     DevProp.lData = 1
    25.     DIDevice.SetProperty DIPROP_BUFFERSIZE, DevProp
    26.    
    27.     DIDevice.Acquire
    28.    
    29.     Init = True
    30.     bLoaded = True
    31.     Exit Function
    32.    
    33. failed:
    34.     Init = False
    35. 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?
    Last edited by Kevin_0011; Oct 26th, 2002 at 11:18 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width