Find Code:
All Words
Any of the Words
Exact Phrase
Home
:
Code
:
Forums
:
Submit
:
Mailing List
:
About
:
Contact
Code
All
VB.NET
ASP.NET
C#
VB Classic
ASP Classic
Snippets
Popular
Resources
Submit Code
Forums
Articles
Tips
Links
Books
Contest
Link to us
VB code for creating a screen saver....
Submitted:
5/7/2000
Version:
VB5
Compatibility:
VB5
Category:
Screen Savers
Views:
33262
VB code for creating a screen saver.
Declarations:
Option Explicit 'API call to hide mouse cursor/pointer Private Declare Function ShowCursor Lib "user32" (ByVal bShow As Long) As Long 'The quit flag Dim Quit As Boolean Dim X As Long
Code:
Private Sub Form_Click() 'If click then stop saver Quit = True End Sub Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer) 'If keypress then stop saver Quit = True End Sub Private Sub Form_Load() 'Hide mouse pointer X = ShowCursor(False) 'Do Not Load More than one occurance If App.PrevInstance = True Then X = ShowCursor(True) Unload Me Exit Sub End If 'Start the screen saver Select Case UCase$(Left$(Command$, 2)) Case "/S" Show Randomize Scale (0, 0)-(1, 1) BackColor = vbBlack 'Graphics Loop Do If Rnd < 0.03 Then ForeColor = QBColor(Int(Rnd * 16)) DrawWidth = Int(Rnd * 9 + 1) End If 'Dots all over the screen PSet (Rnd, Rnd), RGB(Rnd * 255, Rnd * 255, Rnd * 255) 'This checks to see if mouse click, keypress, etc. DoEvents Loop Until Quit = True Timer1.Enabled = True Case Else Unload Me X = ShowCursor(True) Exit Sub End Select End Sub Private Sub Timer1_Timer() X = ShowCursor(True) Unload Me End Sub Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) 'Routine to check for mouse movement Static Xlast, Ylast Dim Xnow As Single Dim Ynow As Single Xnow = X Ynow = Y If Xlast = 0 And Ylast = 0 Then Xlast = Xnow Ylast = Ynow Exit Sub End If If Xnow <> Xlast Or Ynow <> Ylast Then Quit = True End If End Sub
Home
|
Forums
|
Submit
|
Books
|
Mailing List
|
Advertising
|
About
|
Contact
© 2023 A1VBCode. All rights reserved.
Legal disclaimer & terms of use
Privacy statement