Home > other >  A serial port communication m_ctrlComm GetInput (); failure
A serial port communication m_ctrlComm GetInput (); failure

Time:10-12

SCM up a signal, using a serial port debug tool can normal to send, when you use the com control fails, debugging to m_ctrlComm. GetInput (); Failed to perform the place out of the directly, I see a lot of friends have such problems, but didn't the solution, please know that the great god under the guidance of the

If (m_ctrlComm GetCommEvent ()==2)//event value of 2 signifies a character
the receive buffer{////////the following you can according to their own communication protocol join processing code
Variant_inp=m_ctrlComm. GetInput ();//read buffer
Safearray_inp=variant_inp;//the VARIANT type variables into ColeSafeArray type
Len=safearray_inp. GetOneDimSize ();//to get effective data length
for(k=0; kSafearray_inp. GetElement (& amp; K, rxdata + k);//type into a BYTE array
for(k=0; k{
BYTE bt=* (char *) (rxdata + k);//character
Strtemp. The Format (" % c ", bt);//the character into temporary variables strtemp store
M_strRXData +=strtemp;//add receive corresponding string edit box
}
}

CodePudding user response:

I also encountered this problem, the building Lord solved excuse me?
  • Related