K8055d.dll trouble VB 2019

I can’t seem to get any functions/subs from the k8055d.dll to work when I start a new program in Visual Basic 2019. Old programs work just fine and even programs that go through the upgrade process work fine as well. For example if I run this code:

Public Class Form1

Private Declare Function OpenDevice Lib "k8055d.dll" (ByVal CardAddress As Integer) As Integer
Private Declare Sub CloseDevice Lib "k8055d.dll" ()
Private Declare Function ReadAnalogChannel Lib "k8055d.dll" (ByVal Channel As Integer) As Integer
Private Declare Sub ReadAllAnalog Lib "k8055d.dll" (ByRef Data1 As Integer, ByRef Data2 As Integer)
Private Declare Sub OutputAnalogChannel Lib "k8055d.dll" (ByVal Channel As Integer, ByVal Data As Integer)
Private Declare Sub OutputAllAnalog Lib "k8055d.dll" (ByVal Data1 As Integer, ByVal Data2 As Integer)
Private Declare Sub ClearAnalogChannel Lib "k8055d.dll" (ByVal Channel As Integer)
Private Declare Sub SetAllAnalog Lib "k8055d.dll" ()
Private Declare Sub ClearAllAnalog Lib "k8055d.dll" ()
Private Declare Sub SetAnalogChannel Lib "k8055d.dll" (ByVal Channel As Integer)
Private Declare Sub WriteAllDigital Lib "k8055d.dll" (ByVal Data As Integer)
Private Declare Sub ClearDigitalChannel Lib "k8055d.dll" (ByVal Channel As Integer)
Private Declare Sub ClearAllDigital Lib "k8055d.dll" ()
Private Declare Sub SetDigitalChannel Lib "k8055d.dll" (ByVal Channel As Integer)
Private Declare Sub SetAllDigital Lib "k8055d.dll" ()
Private Declare Function ReadDigitalChannel Lib "k8055d.dll" (ByVal Channel As Integer) As Boolean
Private Declare Function ReadAllDigital Lib "k8055d.dll" () As Integer
Private Declare Function ReadCounter Lib "k8055d.dll" (ByVal CounterNr As Integer) As Integer
Private Declare Sub ResetCounter Lib "k8055d.dll" (ByVal CounterNr As Integer)
Private Declare Sub SetCounterDebounceTime Lib "k8055d.dll" (ByVal CounterNr As Integer, ByVal DebounceTime As Integer)


Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
    CloseDevice()
End Sub

When I click Button2, I get an error message as soon as it reaches CloseDevice that “An attempt was made to load a program with an incorrect format. (0x8007000B)”

Same thing happens when I try to open the device with for example:

Dim CardAddress As Integer
Dim h As Integer
CardAddress = 3
If CheckBox1.Checked Then CardAddress = CardAddress - 1
If CheckBox2.Checked Then CardAddress = CardAddress - 2
h = OpenDevice(CardAddress)

…and so on as copied directly from the working example that is provided by Velleman. I’ve copied and pasted the exact code from older, working programs and I get this error every time. Can anyone help?

Hello @Mikem

It can come from the project settings, did you try to change the target platform to “x86” ?

https://www.google.com/search?q=0x8007000B+Visual+Basic

1 Like

Thank you PPAC! That was it. Changed the target CPU to X86 and it worked like a charm.

1 Like

Nice to hear, the problem is solved.

@PPAC thanks for your support, :+1::pray:

1 Like