in reply to Re^5: Creating keybinds GLOBALY!
in thread Creating keybinds GLOBALY!

Actually, it's totally possible to do this under windows. The relevant API is SetSystemWindowHookEx.

Basically, all keyboard (and mouse) input goes through a system queue first before being distributed to individual process and thread queues. The above API allows you to add a hook to this queue and have your application be called back everytime any input is received by the system queue.

However, from experience it is extremely difficult to get right. It also involves providing a callback address (which from Perl would need to be a perl funcition), and I've never managed to get that to work using Win32::API, hence my not recommending it.


Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
Lingua non convalesco, consenesco et abolesco. -- Rule 1 has a caveat! -- Who broke the cabal?
"Science is about questioning the status quo. Questioning authority".
The "good enough" maybe good enough for the now, and perfection maybe unobtainable, but that should not preclude us from striving for perfection, when time, circumstance or desire allow.

Replies are listed 'Best First'.
Re^7: Creating keybinds GLOBALY!
by 5mi11er (Deacon) on Aug 05, 2005 at 19:55 UTC
    I'd figured it was possible, even figured he had the right Win32 module; I was just trying to disuade the OP from attempting to just tack this functionality onto the side of his existing application. It's not likely to be the right thing to do... If it is, I hope he bulldozes through all of those warning him not to do it & eventually posts a CUFP or Snippet on how to do it correctly.

    -Scott