02-13-2004 10:28 AM
02-16-2004 02:59 AM
02-16-2004 09:19 AM
02-16-2017 07:08 AM
Hey Brad
Once I have a .DLL registered how would I gain access to its functions?
I have used the following code to register a .DLL that I am able to use in VBA below is my code in VBScript
Dim myObject, sh, fso, sys, test, hdl Set sh = CreateObject("WScript.Shell") set fso = CreateObject("Scripting.FileSystemObject") set sys = fso.GetSpecialFolder(1) sh.Run(sys &"\regsvr32.exe " &chr(34) &"C:\Program Files\Linkeng\Applications\Linkdata_Vb.dll" &chr(34))
When I execute the code above I get the following pop up.
In VBA I gain access to the DLL like so;
Public Declare Function OpenTest Lib "linkdata_vb.dll" _ Alias "Open_Test" (ByRef hdl As Long, ByVal Name As String) As Long
02-16-2017 09:43 AM
Hi Tim,
VBScript can't access the external DLL by direct declaration, because VBScript, unlike VBS, doe NOT support direct IEEE data types such as the required "long" type in the DLL function prototype. If you wrap the DLL as a COM object, then VBScript can instantiate a variable using that COM object definition with the CreateObject() function. Your other options are to 1) connect to the DLL via LabVIEW and call LabVIEW via the LVRuntime object available in DIAdem VBScripts, or 2) register the DLL as a GPI-DLL with DIAdem.
You're not really still using DIAdem 8.1 are you?
Brad Turpin
DIAdem Product Support Engineer
National Instruments
02-16-2017 09:52 AM
Thanks Brad
No I am not using 8.1. I just replied to this post as it was similar to what I was looking for.
I have tried to register the DLL as a GPI- DLL but when I restart DIadem I get status of "No GPI-DLL"
importing it into Labview requires a *.h file which I am not sure where to get that for this .DLL
My last option is the COM wrapper but I haven't had much luck implementing this
02-16-2017 09:57 AM
Hi Tim,
Yeah, it's not that simple. Your DLL needs to be wrapped as a DIAdem GPI-DLL. You can look into how to do that here:
http://www.ni.com/download/diadem-development-system-2015/517/en/
The resulting GPI-DLL can be added to that dialog, thereafter the commands and variable declared by the GPI-DLL will be globally available in all DIAdem VBScripts and SUDialogs.
Brad Turpin
DIAdem Product Support Engineer
National Instruments