如何用VB制作一个屏幕保护程序
来源:百度文库 编辑:神马文学网 时间:2024/05/07 10:58:03
添加一个窗体frm_Run,和frm_Setup。在frmRun中添加代码:
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
If Mod_Main.Scan_RUN Then ‘如果此时是在运行屏保则关闭屏保
modMain.CloseSCR
End If
End Sub
Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Mod_Main.Scan_RUN Then ‘如果此时是在运行屏保则关闭屏保
modMain.CloseSCR
End If
End Sub
Private Sub Form_Unload(Cancel As Integer)
modMain.CloseSCR
End Sub
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Static sx As Single, sy As Single
If sx = 0 And sy = 0 Then
sx = X
sy = Y
Else
If Abs(sx - X) > 5 Or Abs(sy - Y) > 5 Then End ‘鼠标移动了5象素则退出
End If
End Sub
添加一个模块modMain,添加代码:
Option Explicit
Public Const WM_LOOK As String = “屏保预览(demo)“
Public Const WM_SET As String = “屏保设置(demo)“
Public Const WM_RUN As Stri
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
If Mod_Main.Scan_RUN Then ‘如果此时是在运行屏保则关闭屏保
modMain.CloseSCR
End If
End Sub
Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Mod_Main.Scan_RUN Then ‘如果此时是在运行屏保则关闭屏保
modMain.CloseSCR
End If
End Sub
Private Sub Form_Unload(Cancel As Integer)
modMain.CloseSCR
End Sub
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Static sx As Single, sy As Single
If sx = 0 And sy = 0 Then
sx = X
sy = Y
Else
If Abs(sx - X) > 5 Or Abs(sy - Y) > 5 Then End ‘鼠标移动了5象素则退出
End If
End Sub
添加一个模块modMain,添加代码:
Option Explicit
Public Const WM_LOOK As String = “屏保预览(demo)“
Public Const WM_SET As String = “屏保设置(demo)“
Public Const WM_RUN As Stri