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