-
I have a program that is used to test a product. It has it's own screensaver built in so I can easily update the screensaver's message if a warning arises to alert the operator. I have it set up to start the screensaver after 60 sec of inactivity. I can monitor the mouse anywhere on the screen, but I can not tell if a user is typing outside of my app. So the screensaver tends to kick in if you are, say, typing a long e-mail and don't touch the mouse. I found some code that looks for specific "Hot-keys", but I ned something that fires for any key press, to reset my counter.
Anyone have any ideas???
Thanks!
Glenn
-
There's an API function GetKeyState or something... try this
------------------
[email protected]
...
Every program can be reduced to one instruction which doesn't work.
-
It's GetAsyncKeystate
You can use it in a timer for example:
Private Sub Timer1_Timer()
For i = 1 To 255
If getasynckeystate(i) <> 0 Then
'key has been pressed.
End if
Next i
End Sub
------------------
Razzle
ICQ#: 31429438
What is the difference between a raven?
-The legs. The length is equal, especially the right one. :D
-
Mhm, I meant another function similary to this. But you can get the whole keys in one call like
-
Dim Keys(255) as Long
GetKeyboardState Keys
-
Something like that... Don't know which function u finally need...
------------------
[email protected]
...
Every program can be reduced to one instruction which doesn't work.
-
Thanks guys. That will work, It is a bit better than what I had found.
If I use the array to get the results, is there a faster way than this to see if any of the array has been set to <> 0?
for x = 0 to 255
if Keys(x) <> 0 then
Presed = True
end if
next
if Pressed = True then ....
Thanks again for the help!
Glenn