Home > Software engineering >  How to setup the thread title.
How to setup the thread title.

Time:11-01

The current problem for the use of SetWindowText prompts amorphous illegal member function call,

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 UI

CodePudding user response:

Direct manipulation in the UI thread is more dangerous, can use PostMessage way, to the main thread

CodePudding user response:

WM_SETTEXT
An 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
  • Related