SetDlgItemText function

Sets the title or text of a control in a dialog box.

Syntax


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

Parameters

hDlg [in]

Type: HWND

A handle to the dialog box that contains the control.

nIDDlgItem [in]

Type: int

The control with a title or text to be set.

lpString [in]

Type: LPCTSTR

The text to be copied to the control.

Return value

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

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

Examples

For an example, see Using List Boxes.

Requirements

Minimum supported client

Windows 2000 Professional [desktop apps only]

Minimum supported server

Windows 2000 Server [desktop apps only]

Header

Winuser.h (include Windows.h)

Library

User32.lib

DLL

User32.dll

Unicode and ANSI names

SetDlgItemTextW (Unicode) and SetDlgItemTextA (ANSI)

See also

Reference
GetDlgItemInt
GetDlgItemText
SetDlgItemInt
WM_SETTEXT
Conceptual
Dialog Boxes

 

 

Community Additions

ADD
Show:
© 2014 Microsoft