求助,关于vb.net引用动态链接库?
在打用外部动态链接库打开串口时,出现未处理的“System.ExecutionEngineException”类型的异常出现在 未知模块 中。
HD = New ControlMachine
HD.ConnectedOpen(Me.Handle.ToInt32, "COM1:baud=19200,parity=n,data=8,stop=1")
声明:
<DllImport("DLL4k.dll", CharSet:=CharSet.Ansi, SetLastError:=True)> Private Shared Function OpenDevice(ByVal intMyAddress As Long, ByVal hWnd As Int32) As Long
Public Function ConnectedOpen(ByVal hWnd As Int32, ByVal strRunPortConnectString As String)
Dim blComm As Boolean
Try
intDevice = OpenDevice(255, hWnd) '在这里出错
blComm = ConnectPort(intDevice, strRunPortConnectString)
If blComm Then
ConnectedOpen = True
blConnected = True
Else
ConnectedOpen = False
blConnected = False
End If
Catch ex As Exception
Throw ex
End Try
End Function