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.
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.
07-17-2009 02:35 AM
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
07-17-2009 03:30 AM
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
07-17-2009 03:36 AM
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.
07-17-2009 04:11 AM
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
07-17-2009 04:26 AM
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.. ><
07-19-2009 09:54 PM
07-19-2009 10:16 PM
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.
07-20-2009 01:08 AM
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