By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,383 Members | 2,070 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,383 IT Pros & Developers. It's quick & easy.

mscomm32.ocx inserts additional bytes to a binary stream???

P: n/a

In a VC6 program, a mscomm32.ocx is added to the project and read the
binary incoming RS232 data stream (from a GPS receiver). I use another
commercial serial port debug program to send out a binary file through
com port, read and record the com port data into a disk file. After
file comparison, no error occurs. When the GPS receiver is connected,
my program drops or adds one or two bytes in each data block which is
about 200 bytes. The data block size is seldom correct.
I believe the receiver contains no error, coz it uses embedded MCU.
Then, anyone met the similar mistake before? Maybe CString type
converts one special byte into two bytes stealthily?

Many thank in advance.

The implementation code is listed below:

VARIANT variant_inp;
COleSafeArray safearray_inp;
LONG len,k;

BYTE rxdata[2048];
CString strtemp;
if(m_ctrlComm.GetCommEvent()==2)
{
variant_inp=m_ctrlComm.GetInput();
safearray_inp=variant_inp;
len=safearray_inp.GetOneDimSize();
for(k=0;k<len;k++)
safearray_inp.GetElement(&k,rxdata+k);
for(k=0;k<len;k++)
{
BYTE bt=*(char*)(rxdata+k);
strtemp.Format("%c",bt);
m_strRXData+=strtemp;
}
}

--
arrowlike
------------------------------------------------------------------------
Posted via http://www.codecomments.com
------------------------------------------------------------------------

Nov 17 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Hi,

I have experienced the same problem, while working with MS COM OCX supplied
with Windows CE 3.0 where junk characters are appended, this occurs when the
you are working with Higher Baud Rates(11500).

As i understand it is a bug in the OCX, what i have done is written my own
OCX control from the basic API CreateFile instead of using the COM OCX.

Please let me know if you require the sample code, i can sent it to you.

Sumanth
Project Manager
ELICO Ltd

"arrowlike" wrote:

In a VC6 program, a mscomm32.ocx is added to the project and read the
binary incoming RS232 data stream (from a GPS receiver). I use another
commercial serial port debug program to send out a binary file through
com port, read and record the com port data into a disk file. After
file comparison, no error occurs. When the GPS receiver is connected,
my program drops or adds one or two bytes in each data block which is
about 200 bytes. The data block size is seldom correct.
I believe the receiver contains no error, coz it uses embedded MCU.
Then, anyone met the similar mistake before? Maybe CString type
converts one special byte into two bytes stealthily?

Many thank in advance.

The implementation code is listed below:

VARIANT variant_inp;
COleSafeArray safearray_inp;
LONG len,k;

BYTE rxdata[2048];
CString strtemp;
if(m_ctrlComm.GetCommEvent()==2)
{
variant_inp=m_ctrlComm.GetInput();
safearray_inp=variant_inp;
len=safearray_inp.GetOneDimSize();
for(k=0;k<len;k++)
safearray_inp.GetElement(&k,rxdata+k);
for(k=0;k<len;k++)
{
BYTE bt=*(char*)(rxdata+k);
strtemp.Format("%c",bt);
m_strRXData+=strtemp;
}
}

--
arrowlike
------------------------------------------------------------------------
Posted via http://www.codecomments.com
------------------------------------------------------------------------

Nov 17 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.