The exported name is "CH341OpenDevice" but the posted code Declare statement uses "ch341opendevice". Use the exact name exported from the dll. Also, when you run Dll Export Viewer make sure that the startup option "Undecorate C++ names" is unchecked.
Dll exception
The code below is a part of my form2 code.When I debug it I receive an exception depending on ch341dll.dll file:
Private Declare Function ch341opendevice 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
opening = ch341opendevice(0)
Console.WriteLine(opening)
End Sub
2 additional answers
Sort by: Most helpful
-
RLWA32 47,956 Reputation points
2021-06-07T12:44:49.293+00:00 It is likely that the function is exported by a different name from the DLL.
In a VS Command Prompt window run - dumpbin /exports ch341dll.dll
This will show you the names of the functions exported from the DLL.
-
kaveh rahimi 66 Reputation points
2021-06-08T11:14:22.093+00:00 I did that but the result was an error,and dumpbin is not recognized.Which command line I have to write exactly?What are sequences of this work?