Page 1 of 1
How to detect ANY keyboard activity?
Posted: Sat Oct 27, 2007 7:44 pm
by Seymour Clufley
I could run a For..Next loop going through all the VK codes with GetASyncKeyState, but is there a simpler way to find out if ANY keys have been pressed?
I don't actually need to know what the keys are, you see, I just need to know if the user is typing.
Posted: Sat Oct 27, 2007 7:46 pm
by tinman
Add a callback procedure and check for #WM_KEYDOWN.
Posted: Sat Oct 27, 2007 8:24 pm
by AND51
#PB_Key_All ?
Posted: Sat Oct 27, 2007 9:24 pm
by KarLKoX
A keyboard hook with WH_KEYBOARD could be a solution.
When the dll catch a message, you (the dll) can then send a msg to your app.
Posted: Sat Oct 27, 2007 10:06 pm
by Trond
Code: Select all
OpenWindow(0, 0, 0, 512, 384, "", #PB_Window_ScreenCentered | #PB_Window_SystemMenu)
CreateGadgetList(WindowID(0))
Repeat
Select WaitWindowEvent()
Case #WM_KEYDOWN, #WM_KEYUP
Debug "Type, type"
Case #PB_Event_CloseWindow
Break
EndSelect
ForEver
Posted: Sat Oct 27, 2007 11:03 pm
by djes
AND51 wrote:#PB_Key_All ?
+1 (see doc for KeyboardPushed), only for directx apps
Posted: Sun Oct 28, 2007 7:08 am
by Seymour Clufley
Thank you all for your advice.
Posted: Sat Nov 03, 2007 12:55 pm
by hardfalcon
Have a look at lowlevel keyboard hooks. There's some example code in the code archive, too...