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. Please help with using RegisterHotKey in a Win32 DLL

Please help with using RegisterHotKey in a Win32 DLL

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

    Hi, I am trying to use BOOL RegisterHotKey( HWND hWnd, // window to receive hot-key notification int id, // identifier of hot key UINT fsModifiers, // key-modifier flags UINT vk // virtual-key code ); in my Win32 DLL. I have questions about what to pass to the first parameter. Can I create a hidden window in my DLL and pass its handle to the first parameter of RegisterHotKey function? And then I can process messages received by the hidden window? If this is a way to do it, could you please show me and give me some pointers how to do it, thank you very much. Or do you have any other easy ways to do this? Please let me know, thank you a lot. :) :) :) :) :) :)

    T 1 Reply Last reply
    0
    • J JavaTony

      Hi, I am trying to use BOOL RegisterHotKey( HWND hWnd, // window to receive hot-key notification int id, // identifier of hot key UINT fsModifiers, // key-modifier flags UINT vk // virtual-key code ); in my Win32 DLL. I have questions about what to pass to the first parameter. Can I create a hidden window in my DLL and pass its handle to the first parameter of RegisterHotKey function? And then I can process messages received by the hidden window? If this is a way to do it, could you please show me and give me some pointers how to do it, thank you very much. Or do you have any other easy ways to do this? Please let me know, thank you a lot. :) :) :) :) :) :)

      T Offline
      T Offline
      Tomasz Sowinski
      wrote on last edited by
      #2

      If you pass NULL as first parameter, WM_HOTKEY messages are posted to the message queue of the calling thread and must be processed in the message loop - no window procedure will receive them. If you create hidden window and pass its handle to RegisterHotKey, the window should receive the message. Of course, the calling thread needs a message queue. Tomasz Sowinski -- http://www.shooltz.com

      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