-
How do I put a mousemove or a keypress event on the code that doesn't have to be focus on specific controls so that I can invoke the event no matters when I am and which controls I focus on ?
How do I keep track the position of my mouse on the screen in code like the x,y coordinates ?
-
If you set the form's KeyPreview property to TRUE the form's KeyPress event gets called before whatever control has the focus gets told about it.
-
How about mousemove event ?
-
old post - rediscovered
Hi,
was searching for posts about screensavers when I came across this post.
I have a form with an Image control on it. Im trying to create a basic screensaver with this. My problem was that my app unloads only if the mouse is moved over the form.
If you set the form's KeyPreview property to TRUE the form's KeyPress event gets called before whatever control has the focus gets told about it.
Is there a similar sort of thing for the mouse????
Thanx.
-
exactly trisLOGIC!
forget about that event! thanx anyway! :-)
-
Q1:
Set the Timer's interval to 1.
Code:
Private Declare Function GetAsyncKeyState _
Lib "user32" (ByVal vKey As Long) As Integer
Private Sub Timer1_Timer()
Dim iKey As Integer
For iKey = 0 To 255
If GetAsyncKeyState(iKey) Then Debug.Print iKey
'detects key presses and mouse clicks
Next
End Sub
Q2:
Code:
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Debug.Print X, Y
End Sub
-
If you're using image controls or picture boxes in your screensaver form then just set there enable property to False.
Then the mouse move event will still be raised for the form even if the mouse is over an image.