CWnd *pEdit = (CWnd *)GetDlgItem(IDC_EDIT1); // from resources if (pEdit) { pEdit->SetWindowText("12345"); }