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 Version | user32.dll |
|---|
| Header | Declared in Winuser.h, include Windows.h |
|---|
| Import library | User32.lib |
|---|
| Minimum operating systems |
Windows 95, Windows NT 3.1 |
|---|
| Unicode | Implemented as
ANSI and Unicode versions. |
|---|
See Also