CWnd::SetDlgItemText
TOC
Collapse the table of content
Expand the table of content
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here. ArchiveDisclaimer

CWnd::SetDlgItemText

Sets the caption or text of a control owned by a window or dialog box.

void SetDlgItemText( 
   int nID, 
   LPCTSTR lpszString  
);

nID

Identifies the control whose text is to be set.

lpszString

Points to a CString object or null-terminated string that contains the text to be copied to the control.

SetDlgItemText sends a WM_SETTEXT message to the given control.

// The following code fragment is from CMyDlg::OnInitDialog 
// CMyDlg is derived from CDialog. 

// Initialize dialog controls
SetDlgItemText(IDC_EDITNAME, _T("Type in text")); 
SetDlgItemInt(IDC_EDITNUM, 100);

Header: afxwin.h

Show:
© 2016 Microsoft