SSaver.bas
资源名称:ssaver.zip [点击查看]
上传用户:wje666666
上传日期:2007-03-31
资源大小:8k
文件大小:2k
源码类别:
屏幕保护
开发平台:
Visual Basic
- Attribute VB_Name = "SSaver"
- Option Explicit
- '****Example by Donovan Parks
- '***donopark@awinc.com
- 'declares the Win32 API ShowCursor which is used to hide the cursor
- Declare Function ShowCursor Lib "user32" (ByVal bShow As Long) As Long
- Global giCursorDepth As Integer 'holds original value of ShowCursor
- Public Sub Main()
- 'if there is already a copy of the screen saver running this line terminate
- 'loading a new copy
- If App.PrevInstance Then End
- 'checks to see what command line arguements the screen saver was called
- 'with - '/s' is used when you want the screen saver itself to run
- If InStr(Command, "/s") > 0 Then
- CursorOff
- frmScreenSaver.Show
- 'the '/c' arguement is used when the used presses the settings button from
- 'the Display -> Screen Saver window
- ElseIf InStr(Command, "/c") > 0 Then
- frmSetup.Show
- End If
- End Sub
- Public Sub CursorOff()
- Dim CurrentCursorDepth As Integer
- 'assigns the current value of the cursor to our variable
- CurrentCursorDepth = ShowCursor(False)
- 'assigns giCursorDepth the original value of ShowCursor
- giCursorDepth = CurrentCursorDepth + 1
- 'continues to call ShowCursor with the FALSE arguement until it is less then
- '-1 (hidden)
- Do While CurrentCursorDepth > -1
- CurrentCursorDepth = ShowCursor(False)
- Loop
- End Sub
- Public Sub CursorOn()
- Dim CurrentCursorDepth As Integer
- 'assigns the current value of the cursor to our variable
- CurrentCursorDepth = ShowCursor(True)
- 'assigns giCursorDepth the original value of ShowCursor
- giCursorDepth = CurrentCursorDepth + 1
- 'continues to call ShowCursor until it is less then giCursorDepth - the original
- 'value before the screen saver was executed
- Do While CurrentCursorDepth < giCursorDepth
- CurrentCursorDepth = ShowCursor(True)
- Loop
- End Sub
- Public Sub EndScreenSaver()
- Call CursorOn
- End
- End Sub