|
-
April 25th, 1999, 06:39 AM
#1
MSComm control
I am trying to send binary data through a serial port
using MS communication Control v5.0. The control uses
the VARIANT structure for passing data. I have problems
with sending an array of unsigned chars with the VARIANT
data type. Anyone tried sending binary data using this
control. I have been looking at the VCTERM example, but
it only supports ASCII.
Rune Wemberg
-
May 17th, 1999, 04:40 AM
#2
Re: MSComm control
Hi !
You must use SAFEARRAYs. It's look like:
pMSComm->InputMode = comInputModeBinary;
VARIANT var;
VariantInit ( &var );
var.vt = VT_ARRAY | VT_UI1;
SAFEARRAY* pSA;
SAFEARRAYBOUND bounds = {4, 0};
pSA = SafeArrayCreate ( VT_UI1, 1, &bounds);
unsigned char* ucArray;
SafeArrayAccessData (pSA, (void**)&ucArray);
ucArray [0] = 'A';
ucArray [1] = 'B';
ucArray [2] = 'C';
ucArray [3] = 'D';
SafeArrayUnaccessData (pSA);
var.parray = pSA;
pMSComm->Output = var;
Hope it helps.
Emanuil
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|