home *** CD-ROM | disk | FTP | other *** search
- VERSION 4.00
- Begin VB.Form MainForm
- AutoRedraw = -1 'True
- BorderStyle = 0 'None
- Caption = "Screen Saver Main Form"
- ClientHeight = 6552
- ClientLeft = 3288
- ClientTop = 1812
- ClientWidth = 5772
- Height = 6876
- Left = 3240
- LinkTopic = "Form1"
- MaxButton = 0 'False
- MinButton = 0 'False
- ScaleHeight = 6552
- ScaleWidth = 5772
- ShowInTaskbar = 0 'False
- Top = 1536
- Width = 5868
- Begin VB.Timer Timer1
- Interval = 400
- Left = 1368
- Top = 744
- End
- Attribute VB_Name = "MainForm"
- Attribute VB_Creatable = False
- Attribute VB_Exposed = False
- 'For information about this program see the declarations
- 'section of the JDSaver.BAS module.
- 'This form is the screen saver output, and will cover the screen.
- 'It is called from Sub Main when the program is started with
- 'the /s command parameter
- Option Explicit
- Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
- 'Immediately end when any key is pressed
- Unload Me
- End Sub
- Private Sub Form_Load()
- 'Make the screen saver a TOPMOST window
- tempLong = SetWindowPos(hWnd, HWND_TOPMOST, 0, 0, 0, 0, FLAGS)
- 'Make the form exactly cover the screen
- Move 0, 0, Screen.Width, Screen.Height
- 'Find out from the System Registry if the user
- 'has enabled password protection for screen savers.
- PWProtect = Val(RegGetValue(HKEY_CURRENT_USER, "Control Panel\Desktop", "ScreenSaveUsePassword"))
- 'Haven't found a way for a VB program to use the System
- 'Screen Saver Password, so a separate one is maintained for
- 'this program
- Password = GetSetting("Samples", "JD Screen Saver", "Password")
- 'Copy a clone of the desktop onto the form, to
- 'serve as a background for the circle painting
- CopyScreen Me
- 'Make the cursor disappear
- Do
- Loop Until ShowCursor(False) < -5
- End Sub
- Private Sub Form_MouseDown(Button As Integer, Shift As Integer, x As Single, Y As Single)
- 'Immediately end on any mouse button being pressed
- Unload Me
- End Sub
- Private Sub Form_MouseMove(Button As Integer, Shift As Integer, x As Single, Y As Single)
- Static TimeDelay&
- MouseMoves = MouseMoves + 1
- 'There will probably be a MouseMove event or two at
- 'startup that need to be eaten.
- 'Change value for more or less mouse sensitivity
- 'If you want to get fancy, add a scroll bar on the
- 'configuration form to let the user select sensitivity.
- If MouseMoves = 4 Then
- Unload Me
- End If
- 'MouseMove events are cumulative, so over time there
- 'might be "mouse creep." Reset the counter if more
- 'than 10 seconds have elapsed since mouse movement
- 'began.
- If TimeDelay = 0 Then
- TimeDelay = Timer
- ElseIf Timer - TimeDelay > 10 Then
- TimeDelay = 0
- MouseMoves = 0
- End If
- End Sub
- Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
- 'Before we exit, we need to input a password if
- 'password protection is enabled and a password has
- 'been set by the user.
- If Password <> "" And PWProtect Then
- 'We need a cursor so that the user can move around
- 'the password form
- Do
- Loop Until ShowCursor(True) > 5
- PassCheck.Show 1
- 'PassChck is a Public flag set by the
- 'PassCheck module.
- If PassChck = False Then
- 'Make the cursor disappear again
- Do
- Loop Until ShowCursor(False) < -5
- Cancel = True
- End If
- End If
- End Sub
- Private Sub Form_Unload(Cancel As Integer)
- 'Restore the mouse cursor
- Do
- Loop Until ShowCursor(True) > 5
- End Sub
- Private Sub Timer1_Timer()
- 'Continue to make circles
- Draw Me
- End Sub
-