Visual C++ and MFC Fundamentals Chapter 17: Track-Based Controls
ON_WM_QUERYDRAGICON()
ON_EN_SETFOCUS(IDC_LAST_NAME, OnSetFocusLastName)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
...
void CDialog3aDlg::OnSetFocusLastName()
{
// TODO: Add your control notification handler code here
m_Message.SetWindowText("The First Name has focus");
}
ON_EN_CHANGE: The OnChange event of this notification occurs as the user is typing
text in the edit control. This happens as the user is changing the content of an edit control,
which sends a message that the content of the edit box has changed. You can use this
event to check, live, what the user is doing in the edit box. For example, if you create a
dialog box or a form with a first and last names edit boxes, you can use another edit box
to display the full name. You can implement the OnChange events of the edit boxes as
follows:
BEGIN_MESSAGE_MAP(CDialog3aDlg, CDialog)
//{{AFX_MSG_MAP(CDialog3aDlg)
ON_WM_SYSCOMMAND()
ON_WM_PAINT()
ON_WM_QUERYDRAGICON()
ON_EN_SETFOCUS(IDC_LAST_NAME, OnSetFocusLastName)
ON_EN_CHANGE(IDC_FIRST_NAME, OnChangeFirstName)
ON_EN_CHANGE(IDC_LAST_NAME, OnChangeLastName)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
...
void CDialog3aDlg::OnChangeFirstName()
{
// TODO: Add your control notification handler code here
m_FirstName.GetWindowText(m_strFirstName);
m_LastName.GetWindowText(m_strLastName);
CString FullName = m_strFirstName + " " + m_strLastName;
m_FullName.SetWindowText(FullName);
}
void CDialog3aDlg::OnChangeLastName()
{