LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Calling a LabVIEW dll from VB6

Solved!
Go to solution

Hi All

For a customer I need to create a LabVIEW dll which they can call from their VB6 environment (yes they should upgrade to something else, but that's a different discussion). I have tried to figure out how to do that, but so far with no success.

 

I have found this old post about how to do it: http://forums.ni.com/t5/Example-Program-Drafts/Calling-LabVIEW-created-dll-from-Visual-Basic6/ta-p/3... and it seem to work ok for sending data from VB6 to LV.

 

However, I am not able to recreate it when I build something myself.

 

What I have tried to do is as follows

 

  • Made a simple VI which takes string, reverses it, and returns it
  • Built it into a dll with only this one VI
  • Written a small VB6 program

Private Declare Function ml_str _
Lib "C:\Users\tsuser\Desktop\LVdll_ToFrom_VB6_ml\ml_vb6.dll" _
(ByVal strin As String, _
ByVal strout As String, _
ByRef strlen As Integer) As Long

Private Sub Command1_Click()

Dim instring As String
Dim outstring As String
Dim lengthstr As Integer

Dim retur As Long

instring = "Hello World"

retur = ml_str(instring, outstring, lengthstr)

End Sub

 

When I try to run the VB6 program I get the following error message: "Run-time error 48: File not found". From googling around 

 

Any suggestions on what I'm doing wrong?

 

Thanks and have a nice weekend

 

Martin

0 Kudos
Message 1 of 4
(2,951 Views)

Bump

0 Kudos
Message 2 of 4
(2,887 Views)

It seems like someone managed to make it work here (post is unrelated, but still the attached code can help you): http://forums.ni.com/ni/board/crawl_message?board.id=230&message.id=3826

0 Kudos
Message 3 of 4
(2,877 Views)
Solution
Accepted by topic author MarLentz

Thanks for the link, I hadn't found that exact example myself. Though it wasn't the answer to my specific problem it helped me in the right direction, as I tried to compile the dll with different versions of LV until I realised that I had compiled my own dll in the 64-bit version of LV-2016, which VB6, of course, can't handle - Sometimes the easiest solutions are the hardest to find 😉

0 Kudos
Message 4 of 4
(2,864 Views)