EditBox control Update Problem (A CString type EditBox control in a loop cannot be updated immidiately)

Method One

in the "Add variables " panel, select control instead of value for the category. Then select CListCtrl for variable type.


Let's assume that the variable for the CListCtrl is m_Progress. In the  loop body, adding

   ((CEdit *)GetDlgItem(IDC_List18)->SetWindowText("Hello"))
   UpdateData(false);
   m_Progress.UpdateWindow();

(suggested by a thread from codecomments.com
Create a CEdit member variable such as m_edit. Then you do this to make
it paint immediately:

UpdateData(false);
m_edit.UpdateWindow();


Methods Two


for (;;)
{
//
// ... Your stuff to test
//

{ // Commenting this block will block all messages to app
// until the loop terminates

MSG msg;

while(GetMessage(&msg, 0, 0, NULL))//also try with PeekMessage
{
if(!PreTranslateMessage(&msg))
{
::TranslateMessage(&msg);
::DispatchMessage(&msg);
}
}
}
}



原文地址:https://www.cnblogs.com/cy163/p/547426.html