K8062 - DLL not responding in Visual Basic

Hi All

I’ve built and tested the K8062 USB-DMX interface, and this works fine when I use the supplied “DMX Lightplayer” software which tells me the interface and external DMX lamps are all OK. (This lamp is a 4 channel lamp - Red, Green, Blue and Intensity)

The problem is that I get no response when I try to use the supplied DLL in a Visual Basic programme.

I’ve tried a simple project with four buttons: “StartDevice”, “StopDevice” and two others each of which outputs a simple display using the “SetData” command. (The visual basic code is below).

The problem is that I’m getting nothing from the lamp at all.

When I click “StartDevice”, I can see a “k8062e.exe” process start in Windows Task Manager, and this disappears when I click “StopDevice”. Problem is that nothing happens when I click “setPattern1” or 2.

Can anybody point me in the right direction at all?

The computer setup is WindowsXP, and I’m using Visual Basic Express 2008. No errors are being thrown at all.

Best regards
Paul COULSON

VB Code:

Public Class Form1
Private Declare Sub StartDevice Lib “k8062d.dll” ()
Private Declare Sub SetData Lib “k8062d.dll” (ByVal Channel As Long, ByVal Data As Long)
Private Declare Sub SetChannelCount Lib “k8062d.dll” (ByVal Count As Long)
Private Declare Sub StopDevice Lib “k8062d.dll” ()

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click   //StartDevice button
    StartDevice()

    SetChannelCount(8)
End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click   //setPattern1 button
    SetData(0, 100)
    SetData(1, 0)
    SetData(2, 100)
    SetData(3, 100)
    SetData(4, 100)
    SetData(5, 100)
End Sub

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click   //setPattern2 button
    SetData(0, 100)
    SetData(1, 100)
    SetData(2, 100)
    SetData(3, 0)
    SetData(4, 100)
    SetData(5, 100)
End Sub

Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click   //StopDevice button
    StopDevice()

End Sub

End Class

The only problem is that you are using VB6 code in Visual Basic 2008.
The “As Long” have to be changed to “As Integer”.

Here are the correct function declarations for the Visual Basic 2008:

Private Declare Sub StartDevice Lib "k8062d.dll" () Private Declare Sub SetData Lib "k8062d.dll" (ByVal Channel As Integer, ByVal Data As Integer) Private Declare Sub SetChannelCount Lib "k8062d.dll" (ByVal Count As Integer) Private Declare Sub StopDevice Lib "k8062d.dll" ()

Please see the example in the CD folder: \VM116(K8062) DMX interface\SDK kit\VB.NET

Maybe not immediately but your application would eventually crash, or start acting very strangely. Most of our DLL’s expect 32-bit integers, it’s a bit of a silent rule of thumb to keep in mind

Many many thanks for this. Changing the “long” to “integer” get me communicating.

Just for your information, this was really important to get working as we’re building a sensory room for a handicapped girl, and the DMX controller is crucial to the lighting and effects, so you’ve made a difference!

Thanks again,
Paul.

Nice project, good to hear about things like these