Results 1 to 3 of 3

Thread: ScreenSaverAid needed

  1. #1

    Thread Starter
    New Member
    Join Date
    Mar 2000
    Posts
    2
    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

  2. #2
    Hyperactive Member
    Join Date
    Mar 2000
    Posts
    461
    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

  3. #3
    Addicted Member
    Join Date
    May 1999
    Location
    Californ-I- A
    Posts
    207
    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
  •  



Click Here to Expand Forum to Full Width