|
-
March 29th, 1999, 07:57 PM
#1
Sending a string out port 1
Could someone please tell me the code needed to send out the ascii value of a CString class variable out port 1?
-
March 30th, 1999, 01:30 AM
#2
Re: Sending a string out port 1
Include the MS Commnication control to your object.Create the control in one of
your classes. Use the memeber function for outputting the string to the any of the COM
port.
-
April 13th, 1999, 03:02 AM
#3
Re: Sending a string out port 1
I am able to send a CString all right. But I want to send an array of BYTES :
unsigned char arr[100];
I am able to send this through the Com port using MSComm control. But at the receiving end, I am stuck. The incoming array is available wrapped inside a VARIANT. How to extract my array from within this variant ? Should I use a SafeArray ?
I'm not sure how to convert the variant to SafeArray.
Please help me with a piece of code, if possible.
Thanks.
nikku
-
April 15th, 1999, 09:29 PM
#4
Re: Sending a string out port 1
nikku
The return type is a VARIANT. The vt field (VARTYPE) should be equal to 0x2011 and the parray field data is a pointer to a SAFEARRAY that contains the data.
To find out how many bytes have been received from the port you could do the following:
VARIANT varg;
varg = MSCommObj.GetOutput();
if(varg.vt != 0x2011) // don't know if this absolutely correct!!!
continue;
number of bytes read from COM1 = varg.parray->rgsabound[0].cElements
ptr to array of bytes read = varg.parray->pvData
Kevin M. Reilly
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
|