title: Why doesn't OnKeyDown catch key events in a dialog-based MFC project?
body: <p>I just create a dialog-based project in MFC (VS2008) and add <code>OnKeyDown</code> event to the dialog.
  When I run the project and press the keys on the keyboard, nothing happens. But, if I remove all the controls from the dialog and rerun the project it works.
  What should I do to get key events even when I have controls on the dialog?</p>
  
  <p>Here's a piece of code:</p>
  
  <pre><code>void CgDlg::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
  {
      // TODO: Add your message handler code here and/or call default
      AfxMessageBox(L"Key down!");
      CDialog::OnKeyDown(nChar, nRepCnt, nFlags);
  }
  </code></pre>