Click to Rate and Give Feedback
MSDN
MSDN Library
User Interface
Windowing
Dialog Boxes
Functions
 SetDlgItemText Function

  Switch on low bandwidth view
SetDlgItemText Function

The SetDlgItemText function sets the title or text of a control in a dialog box.

Syntax

BOOL SetDlgItemText(      
    HWND hDlg,     int nIDDlgItem,     LPCTSTR lpString );

Parameters

hDlg
[in] Handle to the dialog box that contains the control.
nIDDlgItem
[in] Specifies the control with a title or text to be set.
lpString
[in] Pointer to the null-terminated string that contains the text to be copied to the control.

Return Value

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

The SetDlgItemText function sends a WM_SETTEXT message to the specified control.

Windows 95/98/Me: SetDlgItemTextW is supported by the Microsoft Layer for Unicode (MSLU). To use this, you must add certain files to your application, as outlined in Microsoft Layer for Unicode on Windows 95/98/Me Systems.

Example

For an example, see Creating a Simple List Box.

Function Information

Minimum DLL Versionuser32.dll
HeaderDeclared in Winuser.h, include Windows.h
Import libraryUser32.lib
Minimum operating systems Windows 95, Windows NT 3.1
UnicodeImplemented as ANSI and Unicode versions.

See Also

Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker