LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

DLL created by LabVIEW 8.2 doesn't work in VB.NET 2005.

I don't know what I am doing wrong here: I have a numeric indicator as a output, I have done as your documentation says, but I get Exception when I calling
the dll .
 
Here the VB program:

Visual Basic 2005 program:

'long __stdcall Snap(char Path[]);/////////This is the function protype.

Imports System
Imports System.Runtime.InteropServices
Imports System.Windows.Forms
Imports System.Threading


Public Class Form1
    Private StopAcquire As Boolean = True
    'This function definition was found from the header file of
    'GrapImage.dll, which is built in LabVIEW

    <DllImport("Snap.dll", EntryPoint:="Snap", _
     CharSet:=CharSet.Auto, CallingConvention:=CallingConvention.StdCall)> _
    Public Shared Function Snap(ByRef Path As String)As Int32
    End Function

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        MsgBox("welcome to use 2005 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.bmp"
        Dim camera_Num As Int32
        StopAcquire = False
        While StopAcquire = False
            camera_Num = Snap(Picture_Addr)       '///////////////////  Exception Occurred!----- "Can't load DLL "Snap.dll":Can't find the appointed module(Exception come from HRESULT:0x8007007E)

            PictureBox1.Load(Picture_Addr)
            Label1.Text = "Totally have" + camera_Num.ToString + "USB Cameras。"
            Thread.Sleep(2000)
        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

Striving is without limit!
0 Kudos
Message 1 of 3
(3,199 Views)

You really should keep all correspondence on the same issue on the same thread.  That is good forum ettiquette.  Please continue in this thread.

I am sorry but I don't have any more information that could help you.

0 Kudos
Message 2 of 3
(3,184 Views)
Hi,
Anyway,I aggre with you opinion,I'll will be careful later,But this issue is different with that.The exception is a new one and previous exception haven't occurred.
Striving is without limit!
0 Kudos
Message 3 of 3
(3,178 Views)