www.pudn.com > gaoScreenSaver.zip > bezier.bas
Attribute VB_Name = "Module1"
Option Explicit
'Function ShowCursor used to hide the cursor during the
'screen saver's runtime, and then enable it upon ending
Declare Function ShowCursor Lib "user32" (ByVal bShow As Long) As Long
'Function FindWindow used in determining whether or not
'another instance of the screen saver is running
Declare Function FindWindow Lib "user32" Alias "FindWindowA" _
(ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Global Plotpoint As Integer
Global start As Integer
Global Maxw As Integer
Global Maxh As Integer
Global Maxc As Integer
Global Maxs As Integer
'Constants
Public Const SW_SHOWNORMAL = 1
Private Const APP_NAME = "Bezier Curves"
Sub Main()
'**********IMPORTANT!!!****************
'Remove this block of code before you compile
'this into a screen saver (.scr) file!
Plotpoint = True
Form1.Show
frmSplash.Show
Form1.Enabled = False
Exit Sub
'***************************************
'*****************************************************
'The screen saver is called one way or another
'and this Sub is called first. Must determine
'what mode screen saver is intended to me run
'and re-direct accordingly.
'*****************************************************
Select Case Mid(UCase$(Trim$(Command$)), 1, 2)
Case "/C" 'Configurations mode called first
Plotpoint = True
Form1.Show
frmSplash.Show
Form1.Enabled = False
Case "", "/S" 'Screensaver mode
runScreensaver
Case "/P" 'Preview mode
End
Case "/A" 'Password protect dialog
MsgBox "Password Protection is not available with this screen saver.", vbInformation, "Sorry!"
End Select
End Sub
Private Sub runScreensaver() 'Run the screen saver
checkInstance 'Make sure no other instances are running
If Plotpoint = False Then
ShowCursor False 'Disable cursor
Else
End If
'load Screen Saver's main form
Load Form1
Form1.Show
End Sub
Sub exitScreensaver() 'Exit the screensaver
ShowCursor True
End
End Sub
Private Sub checkInstance()
'If no previous instance is running, exit sub
If Not App.PrevInstance Then Exit Sub
'check for another instance of screen saver
If FindWindow(vbNullString, APP_NAME) Then End
'Set our caption so other instances can find
'us in the previous line.
Form1.Caption = APP_NAME
End Sub