Global hotkey

Just starting out? Need help? Post your questions and find answers here.
yabune
User
User
Posts: 65
Joined: Mon Aug 22, 2005 2:31 pm

Global hotkey

Post 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!
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Re: Global hotkey

Post by gnozal »

Here is an example with RegisterHotkey_() : http://www.purebasic.fr/english/viewtop ... 13&t=26781
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
User avatar
Kaeru Gaman
Addict
Addict
Posts: 4826
Joined: Sun Mar 19, 2006 1:57 pm
Location: Germany

Re: Global hotkey

Post by Kaeru Gaman »

oh... and have a nice day.
yabune
User
User
Posts: 65
Joined: Mon Aug 22, 2005 2:31 pm

Re: Global hotkey

Post 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
Post Reply