Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Enumerating global hotkeys

120 views
Skip to first unread message

Spud

unread,
Feb 2, 2009, 1:48:26 PM2/2/09
to
I want to enumerate ALL global hotkeys, and details thereof. How to
do this?

When I press control+alt+D, a particular window shows.

I wish to automate this ie write some C++ code to show the window.

Most likely the application has used the WinAPI RegisterHotKey()
function to make Windows send a WM_HOTKEY message to a particular
window every time control+alt+D is detected.

But which window? And how to find the LPARAM and WPARAM of the
WM_HOTKEY message?


http://tds.diamondcs.com.au/dse/detection/hotkeys.php
This software claims to enumerate global hotkeys, and provide the
information I need. However, I have downloaded the free version and
it fails to populate the hotkey subtree. Also I cannot find any
mention on the Internet of how the coders got access to this data.
How?

Sam

Christian ASTOR

unread,
Feb 2, 2009, 2:32:51 PM2/2/09
to
Spud wrote:
> I want to enumerate ALL global hotkeys, and details thereof. How to
> do this?
>
> When I press control+alt+D, a particular window shows.
>
> I wish to automate this ie write some C++ code to show the window.
>
> Most likely the application has used the WinAPI RegisterHotKey()
> function to make Windows send a WM_HOTKEY message to a particular
> window every time control+alt+D is detected.
>
> But which window? And how to find the LPARAM and WPARAM of the
> WM_HOTKEY message?

Call EnumWindows() and send WM_GETHOTKEY inside the EnumWindowsProc
callback function.

Spud

unread,
Feb 3, 2009, 1:42:15 AM2/3/09
to
> Call EnumWindows() and send WM_GETHOTKEY inside the EnumWindowsProc
> callback function.

Thank you for the reply
Unfortunately this approach is not working. only twice does
SendMessage(hwnd, WM_GETHOTKEY, 0, 0); return a nonzero value (1, both
times).

Reading the MSDN documentation, it says there are two concurrent
mechanisms for hot keys that operate independently of one another, the
other being RegisterHotKey(). It states that hotkeys created thus
will not get found by the approach of WM_GETHOTKEY

There must be some way surely to list and remap hotkeys - for example
someone with one usable hand would want control alt delete remapped.
Anyone?

Alf P. Steinbach

unread,
Feb 3, 2009, 2:02:00 AM2/3/09
to
* Spud:

Perhaps the information is stored in the registry.

Cheers & hth.,

- Alf

Christian ASTOR

unread,
Feb 3, 2009, 4:55:09 AM2/3/09
to
On 3 fév, 08:02, "Alf P. Steinbach" <al...@start.no> wrote:
> > There must be some way surely to list and remap hotkeys - for example
> > someone with one usable hand would want control alt delete remapped.
> > Anyone?
>
> Perhaps the information is stored in the registry.

Hot keys from RegisterHotKey() are in fact stored in Kernel mode (like
many others global values, through linked lists...)

Spud

unread,
Feb 3, 2009, 9:30:31 AM2/3/09
to
> Hot keys from RegisterHotKey() are in fact stored in Kernel mode (like
> many others global values, through linked lists...)

Does this mean I have reached a dead end? can anyone offer me
guidance?

I am guessing that when the hot key is pressed, the Windows kernel
sends some WM_HOTKEY message to some window. If I could intercept
this message I could simulate the hotkey.

Can anyone recommend some software that lets me see which messages are
going into which Windows?

Sam

Christian ASTOR

unread,
Feb 3, 2009, 10:59:40 AM2/3/09
to
On 3 fév, 15:30, Spud <SunFi...@gmail.com> wrote:

> I am guessing that when the hot key is pressed, the Windows kernel
> sends some WM_HOTKEY message to some window.  If I could intercept
> this message I could simulate the hotkey.

Yes, you're right.
I've tested with a WH_GETMESSAGE global hook (DLL), and the Hotkey can
be re-assigned with RegisterHotKey()
(tested on XP SP2)

Dean Earley

unread,
Feb 3, 2009, 11:53:56 AM2/3/09
to

What exactly do you want as the end result?
You should be able to simulate hotkeys by just using SendInput.
If you have a window, you can send the hotkey message yourself depending
on what it is passed with.

--
Dean Earley (dean....@icode.co.uk)
i-Catcher Development Team

iCode Systems

Spud

unread,
Feb 4, 2009, 7:39:21 AM2/4/09
to

I have managed to catch the hotkey using this method.
but I am having trouble extracting the data from the message.
The hookproc receives a pointer to a MSG structurethat contains all
the data I need, but I don't seem to be able to set a breakpoint
within the hookproc ( I guess because it is in a DLL ).
I can make the hookproc send a message to my client window, and pass
this pointer. but when I try to dereference it from within my client
window procedure, it fails. I guess this is a general problem of
transferring data across processes... Is there any neat way to
accomplish this? I ask out of curiosity, because I have got the data
I needed:

I have managed to extract all required parameters by sending separate
messages back to my client window procedure and sticking the values in
the lParam one at a time, setting a breakpoint in the window procedure
and viewing the data. it is very ugly, but it works.

Finally I tested it by running SendMessage(blah,blah,blah,blah) and it
simulates pressing the hotkey perfectly.

Thank you all for the help!

Sam

0 new messages