title: Detecting Enter/Return on Keydown event in C++
body: <p>I am trying to detect in my application, if the <kbd>Enter</kbd>/<kbd>Return</kbd> buttons are pressed. My problem is that the <strong>LVN_KEYDOWN</strong> event (Indicates that a key has been pressed) does not detect the  <kbd>Enter</kbd>/<kbd>Return</kbd> key.</p>
  
  <p>I have seen similar questions for other languages, but can not find a solution for C++.</p>
  
  <p>My event to read the key press is:</p>
  
  <pre><code>void ListOption::OnLvnKeydownList1(NMHDR *pNMHDR, LRESULT *pResult)
  {
      LPNMLVKEYDOWN pLVKeyDow = reinterpret_cast&lt;LPNMLVKEYDOWN&gt;(pNMHDR);
      // TODO: Add your control notification handler code here
      if(pLVKeyDow-&gt;wVKey == VK_RETURN)
      {
          OnItemActivateList1(pNMHDR, pResult);
          *pResult = 1;
      }
      *pResult = 0;
  }
  </code></pre>
  
  <p>This code works for almost any key, execept for the <kbd>Enter</kbd> key.</p>
  
  <p>My dialog has only one button, and it's "Default Button" value is FALSE.  How is it possible to detect the keypress?</p>
  
  <p><strong>Update:</strong> My application uses modal dialogs..  It contains a CImageSheet that contains CImagePages(tabs).  Here is an image to explain better (<em>I have placed grey blocks to hide some private data</em>).<br>
  <img src="https://i.stack.imgur.com/HGCws.png" alt="enter image description here"></p>
  
  <p>When I press <kbd>Enter</kbd>, I wish to open a new dialog to change the option.  Currently this is done with the <strong>LVN_ITEMCTIVATE</strong> event (when the user double clicks an item):</p>