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. C / C++ / MFC
  4. Who can help me about hooks using hot-key?

Who can help me about hooks using hot-key?

Scheduled Pinned Locked Moved C / C++ / MFC
tutorialhelpquestion
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.
  • T Offline
    T Offline
    TTT81
    wrote on last edited by
    #1

    I read MSDN about hooks, but I dont know how to write the filter function to take hot_key. Ex: Ctrl + W --> Microsoft Word opens Ctrl + P --> play CD player ... Hope to recieve your guide ! Thank you NewTan

    R 1 Reply Last reply
    0
    • T TTT81

      I read MSDN about hooks, but I dont know how to write the filter function to take hot_key. Ex: Ctrl + W --> Microsoft Word opens Ctrl + P --> play CD player ... Hope to recieve your guide ! Thank you NewTan

      R Offline
      R Offline
      RicoH
      wrote on last edited by
      #2

      First of all, you'll have to make a dll to set a system-wide hook. In this dll you'll have to register your keyboard hook procedure. Your hook function will be called on every keypress the user makes, so at that point you check what key has been pressed and with the function 'GetAsyncKeyState' you can see wether ctrl, alt or one of the shift keys is down as well. Next, you'll have to create an application which loads the dll and call a function in the dll to register the hook procedure (if not done by loading the dll). If you want to keep things clean you should have a funtion in your dll to unhook your thing if you no longer need it, or close your app... Don't think you are, know you are...

      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