title: How to determine if a numpad is present and how to obtain the scan code for the numpad enter key?
body: <p>I would like to add certain behavior to my program that binds a function to the numpad enter key, if it is present, or bind an alternate key if it is not.</p>
  
  <h2><strong>According to Microsoft:</strong></h2>
  
  <blockquote>
    <p>The scan code is the value that the keyboard hardware generates when
    the user presses a key. It is a device-dependent value that identifies
    the key pressed, as opposed to the character represented by the key.
    An application typically ignores scan codes. Instead, it uses the
    device-independent virtual-key codes to interpret keystroke messages.</p>
  </blockquote>
  
  <p><a href="https://docs.microsoft.com/en-us/windows/desktop/inputdev/about-keyboard-input#keyboard-input-model" rel="nofollow noreferrer">(source)</a></p>
  
  <p>I know that on <em>my</em> keyboard it is 0x9C (156), but this is not guaranteed to hold true for all keyboards.</p>
  
  <p>I can't use <code>MapVirtualKey()</code> with <code>VK_RETURN</code> and <code>MAPVK_VK_TO_VSC</code> as this always returns the scan code for the primary return key in the center of the keyboard.</p>
  
  <p>How can I obtain this information without any intervention on the part of the user?</p>
  
  <p>My language is C/C++ and this is for Win32 only.</p>