title: MFC Edit Control EN_KILLFOCUS issue
body: <p>I am using Visual Studio 2013 and making MFC Dialog based application. I am running into strange issue with Kill Focus of Edit Control.</p>
  
  <p>Please see below:</p>
  
  <p>==========================================================================</p>
  
  <p>In my application, I have two Edit Controls on Dialog Box.</p>
  
  <pre><code>1st Edit Control -&gt; IDC_EDIT_QUALITY1
  2nd Edit Control -&gt; IDC_EDIT_QUALITY2
  </code></pre>
  
  <p>I have handled both's EN_KILLFOCUS event to validate the value.</p>
  
  <pre><code>BEGIN_MESSAGE_MAP(CTestDlg, CDialog)
      ON_EN_KILLFOCUS(IDC_EDIT_QUALITY1, &amp;CTestDlg::OnQuality1EditKillFocus)
      ON_EN_KILLFOCUS(IDC_EDIT_QUALITY2, &amp;CTestDlg::OnQuality2EditKillFocus)
  END_MESSAGE_MAP()
  
  void CTestDlg::OnQuality1EditKillFocus()
  {
      ValidateQualityParams(IDC_EDIT_QUALITY1);
  }
  
  void CTestDlg::OnQuality2EditKillFocus()
  {
      ValidateQualityParams(IDC_EDIT_QUALITY2);
  }
  
  #define MIN_QUALITY_VALUE     1     
  #define MAX_QUALITY_VALUE   100
  
  void CTestDlg::ValidateQualityParams(int qualityParamID)
  {
      CString strQuality1;
      if (IDC_EDIT_QUALITY1 == qualityParamID)
      {
          m_ctrlQuality1.GetWindowText(strQuality1);
          if ((_ttoi(strQuality1) &lt; MIN_QUALITY_VALUE) || (_ttoi(strQuality1) &gt; MAX_QUALITY_VALUE))
          {
              CString strMessage;
              strMessage.Format(_T("Quality1 value must be between %d to %d."), MIN_QUALITY_VALUE, MAX_QUALITY_VALUE);
              **AfxMessageBox(strMessage);**
              m_ctrlQuality1.SetSel(0, -1);
              m_ctrlQuality1.SetFocus();
              return;
          }
      }
  
      CString strQuality2;
      if (IDC_EDIT_QUALITY2 == qualityParamID)
      {
          m_ctrlQuality2.GetWindowText(strQuality2);
          if ((_ttoi(strQuality2) &lt; MIN_QUALITY_VALUE) || (_ttoi(strQuality2) &gt; MAX_QUALITY_VALUE))
          {
              CString strMessage;
              strMessage.Format(_T("Quality2 value must be between %d to %d."), MIN_QUALITY_VALUE, MAX_QUALITY_VALUE);
              AfxMessageBox(strMessage);
              m_ctrlQuality2.SetSel(0, -1);
              m_ctrlQuality2.SetFocus();
              return;
          }
      }
  }
  </code></pre>
  
  <p>Now, the issue happens when, after changing the value in 1st Edit Control (IDC_EDIT_QUALITY1), say entering 0 in it and pressing TAB key, the flow goes as below:</p>
  
  <ul>
  <li>void CTestDlg::OnQuality1EditKillFocus() is called.<br></li>
  <li>It calls ValidateQualityParams(IDC_EDIT_QUALITY1)<br></li>
  <li>Inside ValidateQualityParams, it goes to if (IDC_EDIT_QUALITY1 == qualityParamID) condition.<br></li>
  <li>As the value I entered is less than MIN_QUALITY_VALUE, so it shows the Message by calling AfxMessageBox.<br>
  <strong>- Now, even from the callstack of AfxMessageBox, it hits void CTestDlg::OnQuality2EditKillFocus() internally.</strong></li>
  </ul>
  
  <p><strong>Although callstack of OnQuality1EditKillFocus is NOT finished yet, OnQuality2EditKillFocus gets called from the callstack of AfxMessageBox.</strong></p>
  
  <p>I don't understand the cause of this issue. Has anyone encountered such issue before?</p>
  
  <p>In my resource.h, I have two distinct values for <code>IDC_EDIT_QUALITY1</code> and <code>IDC_EDIT_QUALITY2</code></p>
  
  <pre><code> #define IDC_EDIT_QUALITY1               1018
   #define IDC_EDIT_QUALITY2               1020
  </code></pre>
  
  <p>Please help on this issue.</p>