Page 1 of 1

Global hotkey

Posted: Tue Sep 15, 2009 1:44 pm
by yabune
Hi,

What's the best way to register a global hotkey to a functionality of my application?
And how can I catch the event of that key in my application?

I tried to search in the forum, but I'm having some dificulties in having good results in the search function of the new forum.

Thank you!

Re: Global hotkey

Posted: Tue Sep 15, 2009 1:52 pm
by gnozal
Here is an example with RegisterHotkey_() : http://www.purebasic.fr/english/viewtop ... 13&t=26781

Re: Global hotkey

Posted: Tue Sep 15, 2009 1:53 pm
by Kaeru Gaman

Re: Global hotkey

Posted: Tue Sep 15, 2009 2:36 pm
by yabune
gnozal wrote:Here is an example with RegisterHotkey_() : http://www.purebasic.fr/english/viewtop ... 13&t=26781
Thank you :)

Here's what I did:

Code: Select all

RegisterHotKey_(#Null, 0, #MOD_CONTROL, #PB_Shortcut_1)

; and in the main loop:
repeat
  ev=WaitWindowEvent()
  if ev=#WM_HOTKEY
    debug "key detected"
  endif
until ev=#PB_Event_CloseWindow