You can set the text of the Edit control (wrapped in the CEdit class in MFC) by calling SetWindowText , which it inherits from the CWnd base class.
So, all you have to do is respond to the click event on your button control. You do this by listening to the BN_CLICKED notification from the corresponding button control in your parent OnCommand method window.
Sort of:
BOOL CMyDialog::OnCommand(WPARAM wParam, LPARAM lParam) { if (HIWORD(wParam) == BN_CLICKED && LOWORD(lParam) == IDC_MYBUTTON) { m_Edit.SetWindowText(TEXT("My string")); } return CWnd::OnCommand(wParam, lParam); }
Getting and reading a book about MFC would be very helpful. This is pretty straightforward stuff, but it can cover one answer if you don't already understand the fundamental concepts.
Using the class wizard will make it even easier ... Call it using the keys Ctrl + W and follow the instructions on the screen. You will get something like:
void CMyDialog::OnMyButton() { m_Edit.SetWindowText(TEXT("My string")); }
source share