본문 바로가기

개발/mfc

[mfc] control 값 가져오기 설정 하기, sample source

반응형

/****************************************************************************/
/* GetDlgItemText(), GetDlgItemInt(), SetDlgItemText() SetDlgItemInt() 이용
/****************************************************************************/

 CString str;

 GetDlgItemText(IDC_EDIT1, str);
 SetDlgItemText(IDC_STATIC1, str);


 

/************************************************************************/
/* 객체 포인터 이용                                                    
/************************************************************************/
 CString str;

 CEdit* pEdit2 = (CEdit*)GetDlgItem(IDC_EDIT2);
 pEdit2->GetWindowText(str);
 CStatic* pStatic2 = (CStatic*)GetDlgItem(IDC_STATIC2);
 pStatic2->SetWindowText(str);


 

/************************************************************************/
/* 컨트롤 맴버 변수 활용                                               
/************************************************************************/
 CString str;

 m_ctrEdit3.GetWindowText(str);
 m_ctrStatic3.SetWindowText(str);


 

/************************************************************************/
/* 데이터 값을 이용                                                    
/************************************************************************/
 UpdateData(TRUE);
 m_strStatic4 = m_strEdit4;
 UpdateData(FALSE);

반응형