I found something very simple.
Although I still don't understand how it works, but it serves what I need.
The source was at:
http://forums.purebasic.com/english/vie ... 13&t=29773Code:
; use: (Ctrl+a), (F7), and (escape to quit) in any window.
Procedure SetHotKey(*hWnd,Key,Modifiers)
Static ID
ID+1
If RegisterHotKey_(*hWnd,ID,Modifiers,Key)=0
ProcedureReturn -1
EndIf
ProcedureReturn ID
EndProcedure
Procedure HotKeyMsg()
msg.MSG
GetMessage_(@msg,0,0,0)
If msg\message=#WM_HOTKEY
ProcedureReturn msg\wParam
EndIf
EndProcedure
OpenWindow(0,0,0,0,0,"",#PB_Window_Invisible)
*hwnd=GetForegroundWindow_()
hk_ctrla=SetHotKey(WindowID(0),#VK_A,#MOD_CONTROL)
hk_f7=SetHotKey(WindowID(0),#VK_F7,0)
hk_esc=SetHotKey(WindowID(0),#VK_ESCAPE,0)
Repeat
HotKeyEvent=HotKeyMsg()
If HotKeyEvent
Select HotKeyEvent
Case hk_ctrla
;PrintN("Ctrl-A")
MessageBeep_(64)
Case hk_f7
MessageRequester("Hey!", "The F7 key was pressed!", 64)
Case hk_esc
Break
EndSelect
EndIf
Delay(20) ; Don't eat all the CPU time, we're on a multitask OS
ForEver
MessageRequester("Notify", "Bye!", 64)
;EndIf
Sorry if the code got ugly after I modified it, but I'm blind, and the structure makes no difference to my ears.