Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

How to acquire the return value as byte array of CWSerial Control

Hi!

I have some difficulties using the CWSerial ocx component. I want to use it under Borland C++ Builder 5.5, it's test possibility (on the Properties's test panel) works fine, I can send and receive data, but when I want to use it's methods, it doesn't work (the problem can be in using the Variant datatype). Can you send me a short Borland C++ Builder example that sends and receives data as byte array from the serial port?

Program as follows:

void __fastcall TForm1::CWSerial1DataReady(TObject *Sender,
short taskNumber, TVariant *data)
{

unsigned char* CommData;
CommData=(unsigned char*)data;

AnsiString Str;
for( int i=0;i<1
0;i++){
Str=Str+" "+*(CommData+i);
}

Edit1->Text=Str;

}

Thank you in advance!


Software Developer
LiuZongyu
0 Kudos
Message 1 of 2
(3,117 Views)
Unfortunately, we don't directly support Borland C++ programs inside ComponentWorks. The reason for which can be found in one of our KnowledgeBases (#1VCA8PWV).

Also in our KnowledgeBase there are several other interesting articles dealing with Borland C++ in ComponentWorks. Your first stop should be KB #0XC7UQ1J which talks about using Component Works in Borland C++ Builder. Another article dealing with CWSerial is #1HK93JWV.

Hopefully these will help!
0 Kudos
Message 2 of 2
(3,117 Views)