|
-
Mar 27th, 2000, 01:15 PM
#1
Thread Starter
New Member
How to detect movement(mousemove, keypress, etc..) on all my vb forms
so that screensaver form(self design vb form) will not be activitated n activitate screensaver form when no movement detected
URGENT help needed pls
thank U
Code Appreciated badly
-
Mar 27th, 2000, 01:19 PM
#2
Hyperactive Member
Why does your screen saver have to form part of your application?
There is a good article on here regarding the creation of a screen saver using VB.
If you follow that then you will leave Windows the task of determining whether the mouse has moved and all that and that leaves your VB app alone to do its own work.
Just a suggestion
-
Mar 27th, 2000, 02:05 PM
#3
Addicted Member
There's a few things you need to take into consideration.
1. You want to any prevent multiple instances of your screensaver from running. You can do this using API's www.vbapi.com ...
2. You want to hide the cursor, on the form load use the HideCursor API and on the form UnLoad event use the ShowCursor API.
3. On the mouse movement code, you want to additionally add some code so that the form only unloads when there are large movements (because there are almost always tiny mouse movements). Simple use to public variables to hold the last detected movement, and compare to current X and Y ... ie
Public iOldX as integer
Public iOldY as integer
Private Sub MouseMove(bla bla bla)
If X - iOldX >= 100 or X - iOldX <= -100 then
Unload Me
End If
If Y- iOldY >= 100 or Y- iOldY <= -100 then
Unload Me
End If
iOldX = X
iOldY = Y
End Sub
Check out www.micah.carrick.com for a screen saver tutorial ... although it's incompatable with Windows 2000.
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
|