Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Microsoft ActiveX Communication Control

1 view
Skip to first unread message

Stefano Malavasi

unread,
Jan 24, 2002, 4:39:17 AM1/24/02
to
Im using MS ActiveX Communication Control inside my application to
manage serial tx/rx.
After I have received about 1k of byte (no error on those) I got a row
of 60-70 byte of value "63" and I don't know why. The tx seems to be
correct ... here is the code of the rx side.

I hope that someone can help me with this.

Thanks in advance

// Constant

#define ComPort 1
#define ComSettings "115200,E,8,1"
#define ComReceiving 2

// Initialization

m_MSComm1.SetCommPort(ComPort);

m_MSComm1.SetSettings(ComSettings);

m_MSComm1.SetInputMode(1);
m_MSComm1.SetSThreshold(0);
m_MSComm1.SetRThreshold(1);

m_MSComm1.SetInBufferSize(4098);


m_MSComm1.SetPortOpen(TRUE);
if (m_MSComm1.GetCommEvent()==68)
{
MessageBox(Err[1]);
_exit(-1);
}

...

// Rx handle

void CSilverRollerDlg::OnOnCommMscomm1()
{
VARIANT input_buff; // Input buffer
unsigned char *data_p; // data pointer

long aux;
long i,j;
// TODO: Add your control notification handler code here
if (m_MSComm1.GetCommEvent()==ComReceiving)
{
input_buff=m_MSComm1.GetInput();
data_p=(unsigned char *) (input_buff.parray->pvData);

SafeArrayGetLBound(input_buff.parray,1,&j);
SafeArrayGetUBound(input_buff.parray,1,&aux);

while (j<=aux)
{
m_Value=data_p[j];
j++;
UpdateData(FALSE);
}
}
}

--

Stefano Malavasi


0 new messages