Results 1 to 7 of 7

Thread: Screen saver problems!

  1. #1

    Thread Starter
    Frenzied Member CyberCarsten's Avatar
    Join Date
    Sep 1999
    Location
    Aalborg Ø, Denmark
    Posts
    1,544

    Unhappy

    I'm programmin a screen saver....but!!!!
    I have the following code in a timer to draw a circle, but every time the circle is drawed
    and the timer starts to draw a new circle, it starts a new "copy" of the screen saver!!
    This only happens when I test it from the Display settings, not from VB!! What is wrong??

    Code:
    Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
    End
    End Sub
    
    Private Sub Form_Load()
    Timer1.Interval = 1
    End Sub
    
    Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    End
    End Sub
    
    Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    Static Count As Integer
    If Count > 3 Then
        End
    Else
    Count = Count + 1
    End If
    
    End Sub
    
    Private Sub Timer1_Timer()
    Dim CX, CY, Radius, Limit   ' Declare variable.
        ScaleMode = 3   ' Set scale to pixels.
        CX = ScaleWidth / 2 ' Set X position.
        CY = ScaleHeight / 2    ' Set Y position.
        If CX > CY Then Limit = CY Else Limit = CX
        For Radius = 0 To Limit ' Set radius.
            Circle (CX, CY), Radius, RGB(Rnd * 205, Rnd * 70, Rnd * 255)
        Next Radius
    End Sub
    razor
    Software Engineer Student, Aalborg University, Denmark
    http://www.cs.auc.dk

    My email at AUC: will get a new email soon
    My website: http://www.razorsoftware.net


    Windows XP Pro/ Gentoo Linux (Laptop)
    Windows XP Pro (Home PC)

  2. #2
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649
    When you select a screensaver in display properties it keeps starting the screensaver again and again....
    Add this to your Form_Load event:
    Code:
    Private Sub Form_Load()
        If App.PrevInstance Then
            End
        End If
        Timer1.Interval = 1
    End Sub
    Good luck!

  3. #3
    Addicted Member krah's Avatar
    Join Date
    Jan 1999
    Location
    Arkansas, her hyuck!
    Posts
    163

    Unhappy

    Uck! I had this problem a few years ago and didn't know about vb-world.net so I had to do a flimsy file write & check to see if the program had started or not. Things are so much easier here!

    Hey wait a minute...if the screen saver is continuously loading in windows w/o the code fix, does this mean that it is constantly opening and closing itself? Wouldn't that waste a ton of CPU time? (CPU time is the processing power, right?)
    Is it tired in here or is it just me?

    Ryan Williams
    -Using Vb6-

  4. #4
    Hyperactive Member
    Join Date
    Mar 2000
    Location
    India
    Posts
    298
    while on the subject of screensavers......

    how do u make the screensaver stop when the mouse is moved/clicked or if a key is pressed??????




  5. #5

    Thread Starter
    Frenzied Member CyberCarsten's Avatar
    Join Date
    Sep 1999
    Location
    Aalborg Ø, Denmark
    Posts
    1,544
    Thanks for all your replies!!
    To rammy: I have included code that can close the scr when a key is pressed or the mouse is moved/pressed

    razor
    Software Engineer Student, Aalborg University, Denmark
    http://www.cs.auc.dk

    My email at AUC: will get a new email soon
    My website: http://www.razorsoftware.net


    Windows XP Pro/ Gentoo Linux (Laptop)
    Windows XP Pro (Home PC)

  6. #6
    Hyperactive Member
    Join Date
    Mar 2000
    Location
    India
    Posts
    298
    CyberCarsten,

    my problem is that I'm calling another .exe file to use as the screensaver. So, the form's mousemove and mousedown events won't work in this case. I've gotta find another way for this.
    I've managed how to detect the mouse move. What I've done is to use a timer with a small interval, say 10msecs. In the timer's event I'm getting the new and old cursor positions and comparing them. If they are not the same then I'm ending the .exe file.

    This bit of code was posted by someone a few days ago......sorry, have forgetten by whom. Thanx anyway, whoever it was.

    Any ideas abt detecting the mouse click and if any key is pressed.

    Thanx in advance.

  7. #7

    Thread Starter
    Frenzied Member CyberCarsten's Avatar
    Join Date
    Sep 1999
    Location
    Aalborg Ø, Denmark
    Posts
    1,544
    No, I don't think I have any ideas in you case....
    Can't you the same with the Keys.....make a variable in the keypress event and add +1 to it every time a key is pressed, and then compare???

    Hope it helps!


    [Edited by CyberCarsten on 09-10-2000 at 07:19 AM]
    razor
    Software Engineer Student, Aalborg University, Denmark
    http://www.cs.auc.dk

    My email at AUC: will get a new email soon
    My website: http://www.razorsoftware.net


    Windows XP Pro/ Gentoo Linux (Laptop)
    Windows XP Pro (Home PC)

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