📄 mainform.frm
字号:
VERSION 5.00
Begin VB.Form MainForm
AutoRedraw = -1 'True
BorderStyle = 0 'None
Caption = "Screen Saver Main Form"
ClientHeight = 6552
ClientLeft = 3660
ClientTop = 2112
ClientWidth = 5772
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
PaletteMode = 1 'UseZOrder
ScaleHeight = 6552
ScaleWidth = 5772
ShowInTaskbar = 0 'False
Begin VB.Timer Timer1
Interval = 400
Left = 1368
Top = 744
End
End
Attribute VB_Name = "MainForm"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
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"))
'Find out if we are running under NT
GetVersion32
'Disable Ctrl-Alt-Del if appropriate. NT handles password-protected
'screen savers at the system level, so this is only needed for non-NT
'situations with password protection enabled.
If PWProtect And winOS <> WinNT Then
tempLong = SystemParametersInfo(SPI_SCREENSAVERRUNNING, 1&, 0&, 0&)
End If
'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. NT handles its own password
'routines. Thanks to Piotr Mintus for information on
'the use of VerifyScreenSavePwd
If PWProtect And winOS <> WinNT Then
Dim PassChck As Boolean
'We need a cursor so that the user can move around
'the password form
Do
Loop Until ShowCursor(True) > 5
PassChck = VerifyScreenSavePwd(Me.hwnd)
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
're-enable Ctrl-Alt-Del if disabled
If PWProtect And winOS <> WinNT Then
tempLong = SystemParametersInfo(SPI_SCREENSAVERRUNNING, 0&, 0&, 0&)
End If
End Sub
Private Sub Timer1_Timer()
'Continue to make circles
Draw Me
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -