|
-
Jun 13th, 2000, 06:42 PM
#1
Thread Starter
Lively Member
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 ?
-
Jun 13th, 2000, 07:49 PM
#2
Frenzied Member
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.
'Buzby'
Visual Basic Developer
"I'm moving to Theory. Everything works there."
-
Jun 14th, 2000, 12:44 AM
#3
Thread Starter
Lively Member
How about mousemove event ?
-
Aug 30th, 2000, 04:14 AM
#4
Hyperactive Member
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.
-
Aug 30th, 2000, 04:22 AM
#5
Hyperactive Member
exactly trisLOGIC!
forget about that event! thanx anyway! :-)
-
Aug 30th, 2000, 05:09 AM
#6
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
-
Aug 30th, 2000, 05:14 AM
#7
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.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|