NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Compiler error importing TestStand ActiveX Engine with Borland C++ Builder 6

I'm having problems importing TestStand Engine Activex in Borland C++ Builder 6.
In the file "TS_TLB.h" automatically generated, the compiler stops with the error message "E2034: Cannot convert 'Variant' to 'tagSAFEARRAY'"
and the point in source code is...

LPSAFEARRAY __fastcall InsertCodeModules(VARIANT itemList/*[in,opt]*/= TNoParam())
{
_TDispID _dispid(/* InsertCodeModules */ DISPID(18));
TAutoArgs<1> _args;
_args[1] = itemList /*[VT_VARIANT:0]*/;
OleFunction(_dispid, _args);
return _args.GetRetVariant();//<<<<
}

Is there anything like in Delphi Operator Interface help file "readme.doc" that I can do to avoid this problem?
Thank you.
0 Kudos
Message 1 of 5
(4,410 Views)
Hello Axeel -

Just to confirm, when you put a brakepoint in your code and check the variant container at run time, is the array in place? Are you doing any error checking to verify that the variant is of type array? Functions such as this should work so we are curious about what sort of scenario is causing this.

--Regards

Elaine R.
National Instruments
http://www.ni.com/support
0 Kudos
Message 2 of 5
(4,410 Views)
There is a misunderstanding in my previous question:
before I can start writing an O.I. for TestStand, I should import the TestStand ActiveX engine Control in the environment.
To do so in BCB6 I have to select form menu "Components->Import ActiveX Control" the ActiveX component you need, from a list of items available .
After that, BCB6 just like Delphi, creates some new units containig declarations and stuffs like those, in this case "TS_OCX.CPP", "TS_OCX.DCR" "TS_OCX.h" and "TS_TLB.h". Finally, you must recompile your package to install it in the components palette.
Here comes the problem: when you compile the source code just created in BCB6 , you get the error message "E2034: Cannot convert 'Variant' to 'tagSAFEARRAY'".
The compiler indicates this porti
on of source code in the file "TS_TLB.h"
LPSAFEARRAY __fastcall InsertCodeModules(VARIANT itemList/*[in,opt]*/= TNoParam())
{
_TDispID _dispid(/* InsertCodeModules */ DISPID(18));
TAutoArgs<1> _args;
_args[1] = itemList /*[VT_VARIANT:0]*/;
OleFunction(_dispid, _args);
return _args.GetRetVariant();////COMPILER ERROR!!!
}
This is not "run-time" exception error, but a compiler error, that's why I cannot set a breakpoint in the source code.
Thank you and best regards.
Alex Bassi.
0 Kudos
Message 3 of 5
(4,410 Views)
Axeel -
I have never used Borland Builder C++ but I downloaded the trial version 6.0 (Build 10.160) and I was able to use the Project Import Type Library menu command to generate the TS_TLB files. From there I was able to create a simple form application where I dropped the TEngine control from the ActiveX palette, a button control and a timer control for message polling. The code below is what I added to call into TestStand. I did not have any compiling problems.

Hope this helps...

Scott Richardson (NI)


void __fastcall TForm1::Button1Click(TObject *Sender)
{
try
{
VARIANT_BOOL = VARIANT_FALSE;
TNoParam tNoParam;
Ts_tlb::SequenceFilePtr seqFile;
Ts_tlb::ExecutionPtr exePtr;

Form1->Engine1->UIMessagePollingEnabled = true;
seqFile = Form1->Engine1->GetSequenceFile(L"c:\\temp\\temp.seq", 0);
exePtr = Form1->Engine1->NewExecution(seqFile, L"MainSequence", 0,
0, 0, tNoParam, tNoParam, tNoParam);
exePtr->WaitForEnd(-1, 1, tNoParam);
}
catch (Exception &exception)
{
Application->ShowException(&exception);
}
catch (...)
{
try
{
throw Exception("");
}
catch (Exception &exception)
{
Application->ShowException(&exception);
}
}
}
//----------------------------------------------------
void __fastcall TForm1::Timer1Timer(TObject *Sender)
{
Ts_tlb::UIMessagePtr UIMsg;
if (!Form1->Engine1->IsUIMessageQueueEmpty)
{
UIMsg = Form1->Engine1->GetUIMessage();
UIMsg->Acknowledge();
}
}
//-------------------------------
---------------------
Scott Richardson
https://testeract.com
0 Kudos
Message 4 of 5
(4,410 Views)
Axeel -
I realized last night that my testing with Borland C++ was against TestStand 3.0. TestStand 2.x only had a dispatch interface and TestStand 3.0 has a dual interface. It appears that Borland does better with the dual(custom) interface better than the dispatch interface. When I tried to do a test using TestStand 2.0, I did see the compile error that you saw with the import library wrapper that Borland creates. You might want to consider playing and trying TestStand 3.0 to see if Borland likes this better. You can request a fully function trial version of TestStand from NI's web site.

Hope this helps...

Scott Richardson
Scott Richardson
https://testeract.com
0 Kudos
Message 5 of 5
(4,410 Views)