Hello,
A exception occured when I calling the dll created inLabVIEW8.2 from my VB.NET 2005 application.
The compiled DLL exports the follwing function prototype:
void __stdcall Snap(LStrHandle *Path, LStrHandle *CameraName);
And my application program as following:
Imports System
Imports System.Runtime.InteropServices
Imports System.Windows.Forms
Imports NationalInstruments
Imports System.Threading
Public Class Form1
Private StopAcquire As Boolean = True
'This function definition was found from the header file of
'SnapImage.dll, which is built in LabVIEW
Private Declare Sub Snap Lib "E:\builds\Snap\SnapImage\SnapImage.dll" Alias "Snap" (ByVal Path As String, ByVal cameraName As String)
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
MsgBox("Welcome to use VS2005 and LabVIEW!", MsgBoxStyle.OkOnly + MsgBoxStyle.Information, "NI")
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim Picture_Addr As String = "E:\MyPicture"
Dim caremaName As String = ""
StopAcquire = False
While StopAcquire = False
Snap(Picture_Addr, caremaName) 'Exception Occurred! Exception Information:Try to read or write the protected memory,this usually indicate other memories have 'been damaged.
PictureBox1.Load(Picture_Addr)
Label1.Text = caremaName
Thread.Sleep(10)
End While
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
StopAcquire = True
End Sub
End Class
Can anyone know what the problem is?
Thanks in advance!
EnquanLi
China
my Email:leq_82@yahoo.com.cn
Striving is without limit!