SetWindowText

  BOOL SetWindowText(hwnd, lpsz)    
  HWND hwnd; /* handle of window */
  LPCTSTR lpsz; /* address of string */

The SetWindowText function sets the given window's title to the specified text.

Parameters

hwnd

Identifies the window or control whose text is to be changed.

lpsz

Points to a null-terminated character string.

Return Value

The return value is TRUE if the function was successful, or FALSE if an error occurred. Use the GetLastError function to obtain extended error information.

Comments

This function causes a WM_SETTEXT message to be sent to the given window or control.

If the window specified by the hwnd parameter is a control, the text within the control is set. If the specified window is a list-box control created with WS_CAPTION style, however, SetWindowText will set the caption for the control, not for the list-box entries.

The SetWindowText function may be used as either a wide-character function (where text arguments must use Unicode) or an ANSI function (where text arguments must use characters from the Windows 3.x character set).

See Also

GetWindowText