|
-
Sep 9th, 2000, 03:07 PM
#1
Thread Starter
Frenzied Member
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
-
Sep 9th, 2000, 04:25 PM
#2
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!
-
Sep 9th, 2000, 09:48 PM
#3
Addicted Member
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-
-
Sep 10th, 2000, 01:35 AM
#4
Hyperactive Member
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??????
-
Sep 10th, 2000, 04:22 AM
#5
Thread Starter
Frenzied Member
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 
-
Sep 10th, 2000, 04:53 AM
#6
Hyperactive Member
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.
-
Sep 10th, 2000, 06:17 AM
#7
Thread Starter
Frenzied Member
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]
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
|