Rxdatacount++;//this variable is used to receive the character count
Cstrings strTemp;
StrTemp. The Format (" % ld, "rxdatacount);
StrTemp="received:" + strTemp;
M_static_receive_contr. SetWindowText (strTemp);//reception counter
//incoming parameters ch is incoming character data, you can use the data
//check to see whether the hexadecimal display
If (m_check_hex16_disp GetCheck ())
StrTemp. The Format (" % 02 x ", ch);
The else
StrTemp. The Format (" % c ", ch);//the character into temporary variables strtemp store
//m_string_receive +=strTemp;//will receive added to the string of characters
//SetDlgItemText (IDC_EDIT_RECEIVE m_string_receive);//update the display
//the UpdateData (FALSE);//update the display, the same as above a row, this function can also be performed on a timer
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * the following is the process of the casing string displaying * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
//the following program is constantly add receives the string data to the receiving box at the end of eliminating the constantly refresh troubles
M_edit_receive_data. SetSel (1, 1);//selected text in the edit box, 1, 1, said is the last line of the selected
M_edit_receive_data. ReplaceSel (strTemp);//replace text
//if (nLen> 28000)//clear the edit box
{
//m_string_receive. Empty ();
//the UpdateData (FALSE);
}//*/
//access to edit text line number
Int line_count;
Line_count=m_edit_receive_data. GetLineCount ();
/*//remove the part of the line, to prevent the longest string overflow screen
If (line_count & gt; 200)//or nLen> 10000
{
Int line_length=m_edit_receive_data. LineLength (1);//get the first line length
M_edit_receive_data. SetSel (0, 10 * line_length ());//select the edit box line
M_edit_receive_data. ReplaceSel (" ");
//scroll
Line_count=m_edit_receive_data. GetLineCount ();
M_edit_receive_data. LineScroll (line_count, 0);
}//*/
//show the number of rows
StrTemp. The Format (" % ld, "line_count);
StrTemp="lines:" + strTemp;
M_static_receive_line_count. SetWindowText (strTemp);//reception counter
CodePudding user response:
By yourself!!!!!!CodePudding user response:
This is certainly not ah, your time is spent on a new string STR=STR +,Display to display only every time, recommend using richedit,
Using setsel (1, 1), set the cursor to the end, then replacesel increases (string)
CodePudding user response:
Wrong and do, first for richedit,CodePudding user response:
Try this example: http://blog.csdn.net/cvbtvbwu/article/details/24694739CodePudding user response:
1, the use of "event" trigger approach to a serial port communication (asynchronous)2, using a thread processing according to
3, communication, processing, display, respectively, using separate threads
CodePudding user response:
Don't immediately after receiving data to show that to save the memory buffer, when no data is received or free, or when the buffer is full, once again,CodePudding user response:
Text box reaches a certain amount of data display speed is slow, and even pauseMethod 1: show that more than a certain number, the beginning part of the data to remove
Method 2: use a Frame/View framework, in the View through the TextOut output string, a serial port usually only English, display and select the effect of what it is not hard to do
Method 3: use a CWnd custom painting, through the TextOut output string,