/* The original version of this program can be found at http://damb.dk */
#define _WIN32_WINNT 0x0500
#include <windows.h>
#include <stdlib.h>

HHOOK KeyboardHook;

LRESULT LowLevelKeyboardProc(int nCode, WPARAM wParam, LPARAM lParam)
{
   if(nCode == HC_ACTION)
   {
      KBDLLHOOKSTRUCT *HookStruct = (KBDLLHOOKSTRUCT *)lParam;
      if(HookStruct->vkCode == VK_NEXT)
      {
         return TRUE;
      }
   }

   return CallNextHookEx(KeyboardHook, nCode, wParam, lParam);
}

void InstallHook(void)
{
   if(KeyboardHook)
      return;

   KeyboardHook = SetWindowsHookEx(WH_KEYBOARD_LL, (HOOKPROC  )LowLevelKeyboardProc, GetModuleHandle(0), 0);
   if(!KeyboardHook)
   {
      MessageBox(0, "Failed to install Hook", "PageDown Remover", MB_OK);
   }
}

void UnInstallHook(void)
{
   if(KeyboardHook)
      UnhookWindowsHookEx(KeyboardHook);
   KeyboardHook = 0;
}

int main()
{
   InstallHook();
   MessageBox(0, "Hit Ok to close", "PageDown Remover", MB_OK);
   UnInstallHook();
   return EXIT_SUCCESS;
}