Screen Saver

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Ali Rizwan
    Banned
    Contributor
    • Aug 2007
    • 931

    Screen Saver

    Hi
    I want to do something like screensaver.
    If there is no mouse movemeent for a while then a form will appear.
    I m using vb6.
    Thanx
  • QVeen72
    Recognized Expert Top Contributor
    • Oct 2006
    • 1445

    #2
    Hi,

    First Declare one FormLevel Variable (at the top of form's Code window). Add a "Timer Control", Make Forms property KeyPreView =True ;
    Set Timer's Interval =1000 ( 1 second)
    and use this code

    [code=vb]
    Dim ETime As Long

    Private Sub Form_MouseMove( Button As Integer, Shift As Integer, X As Single, Y As Single)
    ETime = 0
    End Sub

    Private Sub Form_KeyPress(K eyAscii As Integer)
    ETime = 0
    End Sub

    Private Sub Timer1_Timer()
    ETime = ETime + 1
    If ETime >= 300000 Then
    ' 300000 = 5 Mins Change this Accordingly
    Timer1.Enabled = False
    ETime = 0
    frmScreenSaver. Show 1
    End If
    End Sub
    [/code]


    In Unload /Terminate event of frmScreenSaver:
    Make : Form1.Timer1.En abled =True


    REgards
    Veena

    Comment

    • Ali Rizwan
      Banned
      Contributor
      • Aug 2007
      • 931

      #3
      Originally posted by QVeen72
      Hi,

      First Declare one FormLevel Variable (at the top of form's Code window). Add a "Timer Control", Make Forms property KeyPreView =True ;
      Set Timer's Interval =1000 ( 1 second)
      and use this code

      [code=vb]
      Dim ETime As Long

      Private Sub Form_MouseMove( Button As Integer, Shift As Integer, X As Single, Y As Single)
      ETime = 0
      End Sub

      Private Sub Form_KeyPress(K eyAscii As Integer)
      ETime = 0
      End Sub

      Private Sub Timer1_Timer()
      ETime = ETime + 1
      If ETime >= 300000 Then
      ' 300000 = 5 Mins Change this Accordingly
      Timer1.Enabled = False
      ETime = 0
      frmScreenSaver. Show 1
      End If
      End Sub
      [/code]


      In Unload /Terminate event of frmScreenSaver:
      Make : Form1.Timer1.En abled =True


      REgards
      Veena
      Thanks for this code its easyone why not it comes into my mind.
      my mind is too slow i have to change battery.
      thanxxxxx

      Comment

      Working...