use COM API from VB 6

Post questions, comments and feedback to our 3Dconnexion Windows Development Team.

Moderator: Moderators

Post Reply
ole@aperio.com
Posts: 2
Joined: Sun Feb 14, 2010 2:18 pm
Location: Vista, CA

use COM API from VB 6

Post by ole@aperio.com »

Greetings...

I am attempting to use the COM API from within VB 6. I am able to access the Device, Sensor, and Keyboard objects, but am not able to handle events. Here is my simple test program:

Code: Select all

Option Explicit

    Private WithEvents Device As TDxInput.Device
    Private WithEvents Sensor As TDxInput.Sensor
    Private WithEvents Keyboard As TDxInput.Keyboard

Private Sub Form_Load()
    Set Device = New TDxInput.Device
    Set Sensor = Device.Sensor
    Set Keyboard = Device.Keyboard

    LabelStatus = "Connecting..."
    Device.Connect
    If Device.IsConnected Then
        If Device.Type = 0 Then
            LabelStatus = "connected but type unknown"
            Device.Disconnect
        Else
            LabelStatus = "connected! - type = " & Device.Type & ", keys = " & Keyboard.Keys
        End If
    Else
        LabelStatus = "not connected"
    End If
End Sub

Private Sub Form_Unload(Cancel As Integer)
    If Device.IsConnected Then
        Device.Disconnect
    End If
    Set Device = Nothing
End Sub

Private Sub Sensor_SensorInput()
    LabelStatus = "sensor input!"
End Sub
The Device is connected but the Sensor_SensorInput handler is never called. If anyone has suggestions for making this work I would be most grateful.

PS replies of the form "why are you using VB 6" will not be helpful :)
Make Pathology Extraordinary!
Post Reply