CodePudding user response:
PostMessage sent to the main thread in the thread, let the main thread to operate to modify the UI, worker threads can not directly modify the UICodePudding user response:
Direct manipulation in the UI thread is more dangerous, can use PostMessage way, to the main threadCodePudding user response:
WM_SETTEXTAn application sends a WM_SETTEXT message to set the text of a window.
WM_SETTEXT
WParam=0;//not 2; Must be zero
LParam=(lParam) (LPCTSTR LPSZ);//the address of the window - the text string
The Parameters
LPSZ
Value of lParam. Pointer to a null - terminated string that is the window text.
The Return Values
The return value is TRUE if The text is set. It is FALSE (for an edit control), LB_ERRSPACE (for a list box), or CB_ERRSPACE (for a combo box) if insufficient space is available to set The text in The edit control. It is CB_ERR if this message is sent to a combo box without an edit control.
EndMessage (g_hEdit WM_SETTEXT, 0, (LPARAM) szBuffer);
CodePudding user response:
Use the SetWindowText API