Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Managed C++/CLI
  4. How to activate keys combination with hook ?

How to activate keys combination with hook ?

Scheduled Pinned Locked Moved Managed C++/CLI
tutorialquestion
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Z Offline
    Z Offline
    zayl543
    wrote on last edited by
    #1

    Hi To get the symbol @ for example, I must press two buttons at seem time [Alt Gr] + [button with a and 0 near the backspace button]. So actually my application didn't support keys combination, so when I press this combination I get letter 'a' instead of symbol '@'. I am using VCE 2008. Here is the function I am using :

    LRESULT WINAPI EventKey(int nCode, WPARAM wParam, LPARAM lParam)
    {
    if( (nCode == HC_ACTION) && ( (wParam == WM_SYSKEYDOWN) || (wParam == WM_KEYDOWN) ))
    {
    kbdStruct = *((KBDLLHOOKSTRUCT*)lParam);
    nChar = getKeyFromvcode(kbdStruct.vkCode, (PWCHAR)&outputChar, (PWCHAR)&deadChar);

    if(nChar > 0){/* Record the key*/}

    }

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

    How can I tell the application to convert keys combinations to its associated letters or symbols ? Regards

    S 1 Reply Last reply
    0
    • Z zayl543

      Hi To get the symbol @ for example, I must press two buttons at seem time [Alt Gr] + [button with a and 0 near the backspace button]. So actually my application didn't support keys combination, so when I press this combination I get letter 'a' instead of symbol '@'. I am using VCE 2008. Here is the function I am using :

      LRESULT WINAPI EventKey(int nCode, WPARAM wParam, LPARAM lParam)
      {
      if( (nCode == HC_ACTION) && ( (wParam == WM_SYSKEYDOWN) || (wParam == WM_KEYDOWN) ))
      {
      kbdStruct = *((KBDLLHOOKSTRUCT*)lParam);
      nChar = getKeyFromvcode(kbdStruct.vkCode, (PWCHAR)&outputChar, (PWCHAR)&deadChar);

      if(nChar > 0){/* Record the key*/}

      }

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

      How can I tell the application to convert keys combinations to its associated letters or symbols ? Regards

      S Offline
      S Offline
      sanjaylk
      wrote on last edited by
      #2

      From your code snippet , it seems you are hooking keyboard to detect your combination you must check virtual key codes for ALT and other keys check msdn link http://msdn.microsoft.com/en-us/library/ms927178.aspx[^] and also search for key logger on code project

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups