I'd used declare statement in my code:
Private Declare Function CH341OpenDevice Lib "CH341DLL.DLL" (ByVal iIndex As Integer) As Integer
Private Declare Function CH341WriteI2C Lib "CH341DLL.DLL" (ByVal iindex As Integer, ByVal idevice As Integer, ByVal iaddr As Integer, ByVal ibyte As Integer) As Boolean
Private Declare Function CH341ReadI2C Lib "CH341DLL.DLL" (ByVal iindex As Integer, ByVal idevice As Integer, ByVal iaddr As Integer, ByVal obyte As Integer) As Integer
Private Declare Function CH341CloseDevice Lib "CH341DLL.DLL" (ByVal iIndex As Integer) As Integer
Private Declare Function CH341ResetDevice Lib "CH341DLL.DLL" (ByVal iIndex As Integer) As Integer
Sub main()
MsgBox("ok")
End Sub
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
Dim opening As Integer
Dim closing As Integer
Dim writing As Integer
Dim reading As Integer
Dim reseting As Integer
reseting = CH341ResetDevice(0)
opening = CH341OpenDevice(0)
writing = CH341WriteI2C(0, 86, 22, 90)
reading = CH341ReadI2C(0, 48, 91, 91)
closing = CH341CloseDevice(0)
MsgBox(reseting)
MsgBox(writing)
MsgBox(closing)
End Sub
But when I run the code it returns value of CH341WriteI2C() wrong(for example zero).