From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Call LabVIEW dll in VBScript

Hi,

 

How do you call a function that is generated using LabVIEW DLL in VBScript?

I have a project which needs to integrate SIMATIC WinCC Flexible with LabVIEW, in which WinCC Flex uses VBScript language.

Is it possible to do it?

 

Thanks for your replies 

0 Kudos
Message 1 of 8
(4,500 Views)

It should be possible just like calling any other DLL from within VBScript. So look for those examples first to get an idea how this has to be done. And on the LabVIEW side, make sure you do not use LabVIEW specific datatypes as function parameters but stick with the standard C datatypes. So no handles of any kind, but simply skalars (integers, floats and doubles), and C string pointers and C array pointers.

 

Rolf Kalbermatter

Rolf Kalbermatter
My Blog
Message 2 of 8
(4,493 Views)

Hi Rolf,

 

Thanks for your reply. 

I couldn't find any examples of calling LabVIEW DLL from VBScript. There are only Visual Basic examples available. From the VBScript reference, to call DLL is by CreateObject(<param>) method, but I don't have any idea of how to fill in the parameter of the method.

 

Do you have good examples or reference?

Thank you.

0 Kudos
Message 3 of 8
(4,488 Views)

I do not know VBScript but CreateObject<param> does not look like the definition for a call to a normal DLL. This looks rather like the method to import and instantiate an ActiveX or possibly .Net Object.

 

Those objects can be in a DLL too but are completely different from the DLLs that get createdby LabVIEW. LabVIEW creates a so called standard shared library. This is a library that exports a number of functions that can be imported by another language function by function. In Visual Basic you would do something like:

Declare Function name Lib "libname" [ Alias "aliasname" ] [([ arglist ])] As returnType

 

name would be the name you want to use the function in your Visual Basic program with.

libname is the DLL name

aliasname is required if the exported name in the DLL is different than the name you gave the function here

arglist is the arguments

and returnType is the return value the function returns

 

Can't say if VBScript knows this or uses the exact same syntax but it is likely that it is very similar.

 

Rolf Kalbermatter

 

 


Rolf Kalbermatter
My Blog
0 Kudos
Message 4 of 8
(4,485 Views)

Hi Rolf,

 

The Declare and Lib keywords are not part of the VBScript's keywords. Anyway, thanks for the input.

CreateObject() is used to create a reference to certain object, e.g. Windows Shell -> WSHShell. I assumed VBScript is unable to call LabVIEW DLL in this case.

 

Argghh.... I have no idea how to do the integration between SCADA and LabVIEW.. beside using this approach.

I am dead.. ><

0 Kudos
Message 5 of 8
(4,482 Views)
I believe the problem come from the fact that VBScript only supports COM dll as shown in http://www.visualbasicscript.com/m_55185/tm.htm
Therefore, calling LabVIEW dll is not your option.
What I can think of is:
1. Calling LabVIEW exe, and get its return from a written file. >> Need to install LabVIEW runtime.
2. Calling LabVIEW Automation interface. >> Need to install LabVIEW development.
For #2, I attached you an Excel file for your example.
0 Kudos
Message 6 of 8
(4,453 Views)

Hi Kate,

 

Thanks for your input.

For the 2nd option, is it the same as integrating LabVIEW ActiveX control to 3rd party application? I found that this option may not be stable for all application. Do you have any good experience for option #2?

 

I am not sure about the first option though. 

0 Kudos
Message 7 of 8
(4,448 Views)

Option 1 does require the installation of LabVIEW runtime but so does the use of a LabVIEW created DLL to execute it, so no loss there.

 

Option 2 is not really a LabVIEW Active X Control but you are using LabVIEW's Automation Server. This can also work for a built application if you enable the ActiveX server interface in the build specification.

 

If it is stable? I'm not sure. It is quite a complicated piece of software and I have always been very careful about using Active X anywhere in a project. If it is absolutely unaviodable I have used it and alsways got it to work reliably but it can be a bit painful. And the issues were often not on the LabVIEW side of ActiveX but on less than good implementations of the ActiveX Controls or Automation Server interfaces themselves. Many ActiveX components that are sold on the net are really justsome hobby projects that got put together in Visual Basic or something and I have not a great opinion about these.

 

Rolf Kalbermatter

Rolf Kalbermatter
My Blog
0 Kudos
Message 8 of 8
(4,440 Views)