Skip to content

Latest commit

 

History

History
129 lines (88 loc) · 4.65 KB

nf-winuser-setwindowtextw.md

File metadata and controls

129 lines (88 loc) · 4.65 KB
UID title description helpviewer_keywords old-location tech.root ms.assetid ms.date ms.keywords req.header req.include-header req.target-type req.target-min-winverclnt req.target-min-winversvr req.kmdf-ver req.umdf-ver req.ddi-compliance req.unicode-ansi req.idl req.max-support req.namespace req.assembly req.type-library req.lib req.dll req.irql targetos req.typenames req.redist ms.custom f1_keywords dev_langs topic_type api_type api_location api_name req.apiset
NF:winuser.SetWindowTextW
SetWindowTextW function (winuser.h)
Changes the text of the specified window's title bar (if it has one). If the specified window is a control, the text of the control is changed. However, SetWindowText cannot change the text of a control in another application. (Unicode)
SetWindowText
SetWindowText function [Windows and Messages]
SetWindowTextW
_win32_SetWindowText
_win32_setwindowtext_cpp
winmsg.setwindowtext
winui._win32_setwindowtext
winuser/SetWindowText
winuser/SetWindowTextW
winmsg\setwindowtext.htm
winmsg
VS|winui|~\winui\windowsuserinterface\windowing\windows\windowreference\windowfunctions\setwindowtext.htm
12/05/2018
SetWindowText, SetWindowText function [Windows and Messages], SetWindowTextA, SetWindowTextW, _win32_SetWindowText, _win32_setwindowtext_cpp, winmsg.setwindowtext, winui._win32_setwindowtext, winuser/SetWindowText, winuser/SetWindowTextA, winuser/SetWindowTextW
winuser.h
Windows.h
Windows
Windows 2000 Professional [desktop apps only]
Windows 2000 Server [desktop apps only]
SetWindowTextW (Unicode) and SetWindowTextA (ANSI)
User32.lib
User32.dll
Windows
19H1
SetWindowTextW
winuser/SetWindowTextW
c++
APIRef
kbSyntax
DllExport
User32.dll
API-MS-Win-NTUser-IE-Window-l1-1-0.dll
ie_shims.dll
API-MS-Win-RTCore-NTUser-Window-l1-1-0.dll
minuser.dll
Ext-MS-Win-NTUser-Window-l1-1-0.dll
Ext-MS-Win-NTUser-Window-l1-1-1.dll
Ext-MS-Win-NTUser-Window-l1-1-2.dll
Ext-MS-Win-RTCore-NTUser-Window-Ext-l1-1-0.dll
ext-ms-win-ntuser-window-l1-1-3.dll
Ext-MS-Win-NTUser-Window-L1-1-4.dll
SetWindowText
SetWindowTextA
SetWindowTextW
ext-ms-win-ntuser-window-l1-1-3 (introduced in Windows 10, version 10.0.10240)

SetWindowTextW function

-description

Changes the text of the specified window's title bar (if it has one). If the specified window is a control, the text of the control is changed. However, SetWindowText cannot change the text of a control in another application.

-parameters

-param hWnd [in]

Type: HWND

A handle to the window or control whose text is to be changed.

-param lpString [in, optional]

Type: LPCWSTR

The new title or control text.

-returns

Type: BOOL

If the function succeeds, the return value is nonzero.

If the function fails, the return value is zero. To get extended error information, call GetLastError.

-remarks

If the target window is owned by the current process, SetWindowText causes a WM_SETTEXT message to be sent to the specified window or control. If the control is a list box control created with the WS_CAPTION style, however, SetWindowText sets the text for the control, not for the list box entries.

To set the text of a control in another process, send the WM_SETTEXT message directly instead of calling SetWindowText.

The SetWindowText function does not expand tab characters (ASCII code 0x09). Tab characters are displayed as vertical bar (|) characters.

Examples

For an example, see Sending a Message.

Note

The winuser.h header defines SetWindowText as an alias which automatically selects the ANSI or Unicode version of this function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more information, see Conventions for Function Prototypes.

-see-also

Conceptual

GetWindowText

Reference

WM_SETTEXT

Windows