Export (0) Print
Expand All
MFC
Expand Minimize

CWnd::SetDlgItemText 

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


void SetDlgItemText(
   int nID,
   LPCTSTR lpszString 
);

Parameters

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.

BOOL CDataDlg::OnInitDialog() 
{
   CDialog::OnInitDialog();
   
   // Initialize dialog controls
   SetDlgItemText(IDC_EDIT_NAME,"Type in text"); 
   SetDlgItemInt(IDC_EDIT_NUM, 100);
   return TRUE;  // return TRUE unless you set the focus to a control
}

Community Additions

ADD
Show:
© 2014 Microsoft