Internet information need multi-threaded control, MSComm control how to use multithreading to solve this problem, or have other way? O people,,,,,,,,
Following is receive events part code:
Void CSerialCommAppDlg: : OnCommMscomm1 ()
{
//TODO: add message handler code here
The VARIANT m_varInput;
Cstrings strtemp;
COleSafeArray safearray_input;
Long len=0, k=0;
BYTE RxData [MAX_BUFFER_SIZE];//set the byte array MAX_BUFFER_SIZE=2048
Strtemp. Empty ();
If (m_MSComm get_CommEvent ()==2)//event 2 said accept buffer has the characters
{
M_varInput=m_MSComm. Get_Input ();//read the receive buffer
//safearray_input=m_varInput;//the variant data into a colesafearray type variable
Safearray_input. Attach (m_varInput);
Len=safearray_input. GetOneDimSize ();//to get effective data length
For (k=0; K
If (m_checkHEXShow GetCheck ())//select hexadecimal display
{
For (k=0; K & lt; Len. K++)
{
Strtemp. The Format (_T (" % 02 x "), * (RxData + k));//convert type BYTE array into HEX variable
M_editRecieve +=strtemp;//add receive corresponding string edit box
}
}
The else
{//select character display
For (k=0; K & lt; Len. K++)
{
Strtemp. The Format (_T (" % c "), * (RxData + k));//convert type BYTE array into cstrings type variable
M_editRecieve +=strtemp;//add receive corresponding string edit box
}
}
M_editRecieveNum +=len;//receive bytes count
M_strRichEditRecieve. The Format (_T (" receive: % d "), m_editRecieveNum);
The UpdateData (false);//update the content of the edit box
//m_ceditRx SetSel (1, 1);
//this - & gt; SetDlgItemTextW (IDC_EDIT2 m_editRecieve);//will m_EditReceive content displayed to the end of the ID for IDC_EDIT2 edit box location
M_ceditRx. LineScroll (m_ceditRx. GetLineCount () - 1, 0).//the vertical scroll bar to scroll to the last line
}
}
CodePudding user response:
O Daniel,,,,,,,,CodePudding user response:
Why still no one to help us see,,, your top