LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

LabVIEW6 as Automation Server in Borland C++ Builder

I am having trouble using LabVIEW6 as an automation server with Borland C++ Builder 4.0. I am able to create the LabVIEW application object and get properties and call "BringToFront", but I get error when calling GetVIReference. I've tried passing various values to the three parameters. I recieve the following error: "The server threw an exception". Any ideas? Here's my code:

Variant oApp;
Variant oVI;
oApp = CreateOleObject("LabVIEW.Application"); //works
oApp.OleFunction("BringToFront"); //works
oVI = oApp.OleFunction("GetVIReference", "C:\\Program Files\\National Instruments\\LabVIEW 6\\activity\\solution\\Multiple Random Plot.vi", "", 0); //error
0 Kudos
Message 1 of 5
(3,052 Views)
If all the other ActiveX code works and the GetVIReference failed, then I'd guess either the LabVIEW settings or the file path. In LabVIEW, check under the VI Server configuration options (Tools>>Options). Make sure that ActiveX is checked and that all the Allow boxes are checked. Then check the exported VIs and make sure the VI you are calling or the wild "*" character are in the list with a check. If that all checks out, try using DOS paths c:\\Progra~1\\..
0 Kudos
Message 2 of 5
(3,052 Views)
I've verified the VI Server configuration settings...ActiveX and all Allow boxes are checked. moved the target VI to c:\, root, directory. I also verified that I have exported the "*" wild card. I get the same error on GetVIReference. It must be something else.

The only thing I can think of is that the parameter types are not translating properly on the OleFunction() call. I'm passing ('string', 'string', int) to GetVIReference. The second string (password param) being an empty string.

Incidently, I can't get the Visual C++ example to work either. I don't get the same error, but that error is likely to be different in Microsofts MFC than in Borland's VCL. I've tried this on a WIN NT 4.0 machine and a WIN ME machine with the same results.

Is
there an error log that is created by LabVIEW6.0 somewhere?
0 Kudos
Message 3 of 5
(3,052 Views)
Yes, there is a failure log, though I'm not sure if it will record anything unless labview is actually crashing. It should be in LabVIEW's temp directory and is called LabVIEW_Failure_Log.txt . I've used the VC example, and it worked last time I tried it. I'll take another look at it and see if there was some trick to it. Unfortunately, I don't use Borland, so I may not be much help from that angle.
0 Kudos
Message 4 of 5
(3,052 Views)
A bit late but try using WideString

oVI = oApp.OleFunction("GetVIReference", WideString("C:\\Program Files\\National Instruments\\LabVIEW 6\\activity\\solution\\Multiple Random Plot.vi"),WideString(""), 0); //error"
0 Kudos
Message 5 of 5
(3,052 Views)