title: Hook Keyboard to change the key code
body: <p>I have buy this keyboard <a href="http://www.mobilitylab.eu/mini-design-touch-silver.html" rel="nofollow">http://www.mobilitylab.eu/mini-design-touch-silver.html</a> of 107 touch, 
  and I want a keypad to put it on my left hand.
  but when we activate the numlock of the keypad, it activates the numlock on the keyboard.
  So we have 456- instead of uiop.
  I have found this program but it don't work on a 64 bits OS. <a href="http://www.bellamyjc.org/fr/systeme.html#knumlock" rel="nofollow">http://www.bellamyjc.org/fr/systeme.html#knumlock</a>.</p>
  
  <p>So i want to do my own program with C++, but it don't work fine, the hook is allright (WH_GETMESSAGE) but i don't understand how we can change the keycode and how we can find if it's a key of the keypad or the keybord ?</p>
  
  <p>Here this is my code where i try to change the message :</p>
  
  <pre><code>//-----------------Keyboard Hook Callback---------------//
  Hookmsg_API LRESULT CALLBACK Hookmsg(int ncode,WPARAM wparam,LPARAM lparam){
      //if(ncode&gt;=0) //
      if(ncode&lt;0)
          return CallNextHookEx(hook,ncode,wparam,lparam);
      MSG *msg;
      msg=(MSG *)lparam;
      WORD newVK,oldVK;
      WORD newSC,oldSC;
  
      if(ncode==HC_ACTION)
      {
          if((msg-&gt;message == WM_KEYUP))//Check whether key was pressed(not released).)
          { 
              oldVK=msg-&gt;wParam;
              oldSC=SCANCODE(msg-&gt;lParam);
              bool extendkey=false;
              if(((HIWORD(msg-&gt;wParam) &amp; 0x0100) == 0x0100))
              {
                  extendkey=true;
              }
              if(!extendkey)
              {
                  bool modif=true;
                  switch(oldVK)//wparam
                  {
                      case VK_INSERT: newVK=VK_NUMPAD0; break;
                      case VK_END: newVK=VK_NUMPAD1; break;
                      case VK_DOWN: newVK=VK_NUMPAD2; break;
                      case VK_NEXT: newVK=VK_NUMPAD3; break;
                      case VK_LEFT: newVK=VK_NUMPAD4; break;
                      case VK_CLEAR: newVK=VK_NUMPAD5; break;
                      case VK_RIGHT: newVK=VK_NUMPAD6; break;
                      case VK_HOME: newVK=VK_NUMPAD7; break;
                      case VK_UP: newVK=VK_NUMPAD8; break;
                      case VK_PRIOR: newVK=VK_NUMPAD9; break;
                      case VK_DELETE: newVK=VK_DECIMAL; break;
                      default: modif=false;
                  }
                  if(modif==true)
                  {
  
                      msg-&gt;wParam = VK_NUMPAD0;
                      UINT newSC=MapVirtualKey(VK_NUMPAD0,MAPVK_VK_TO_VSC);
                      msg-&gt;lParam &amp;= 0xFF00;
                      msg-&gt;lParam += (newSC &lt;&lt; 16 );
                      //MessageBox( NULL, TEXT("OK"), TEXT("Error!"), MB_OK);
                  }
              }
  
          }
      }
      return ( CallNextHookEx(hook,ncode,wparam,lparam) );//pass control to next hook in the hook chain.
  }
  </code></pre>