Restored from previous forum. Originally posted by PB.
> Anyone know how to within a PB app, detect when a window Shortcut
> keys is pressed, these are usualy CTRL+ALT+.
> it's windows specific so API will do...
There is probably a better and cleaner way to do it, but try this:
Code: Select all
; Clear key buffers before use.
GetAsyncKeyState_(#VK_CONTROL)
GetAsyncKeyState_(#VK_SHIFT)
GetAsyncKeyState_(#VK_H)
;
If OpenWindow(0,200,200,450,200,#PB_Window_SystemMenu,"Test")
CreateGadgetList(WindowID())
ButtonGadget(0,50,50,100,21,"Press Shift+Ctrl+H")
Repeat
Sleep_(1) : ev=WindowEvent() ; Don't use WaitWindowEvent or we won't see the keypress.
If GetAsyncKeyState_(#VK_H)=-32767 And GetAsyncKeyState_(#VK_CONTROL)=-32767 And GetAsyncKeyState_(#VK_SHIFT)=-32767
MessageBeep_(#MB_ICONASTERISK)
EndIf
Until ev=#PB_EventCloseWindow
EndIf
> Registered PureBasic User, 2.60-)
Still using v2.60 -- why not upgrade to v3.30?
PB - Registered PureBasic Coder