home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Mother of All Windows Books
/
CD-MOM.iso
/
cd_mom
/
newsletr
/
vbz
/
vbz1-3
/
ssmain.bas
< prev
next >
Wrap
BASIC Source File
|
1993-06-18
|
3KB
|
93 lines
DefInt A-Z
Global TimeToGo
Declare Sub DeleteDC Lib "GDI" (ByVal hDC)
Declare Sub BitBlt Lib "GDI" (ByVal DestDC, ByVal X, ByVal Y, ByVal BWidth, ByVal BHeight, ByVal SourceDC, ByVal X, ByVal Y, ByVal Constant&)
Declare Function ShowCursor Lib "User" (ByVal nShow)
Declare Function SystemParametersInfo Lib "User" (ByVal uAction, ByVal uParam, lvParam As Any, ByVal fuWinIni)
Declare Function CreateDC Lib "GDI" (ByVal Driver$, ByVal Dev&, ByVal O&, ByVal Init&)
Declare Function GetDeviceCaps Lib "GDI" (ByVal hDC, ByVal nIndex)
Const SPI_SETSCREENSAVEACTIVE = 17
Const HORZRES = 8
Const VERTRES = 10
Function GetPW ()
If GetSSIniLong("PWProtected", 0) = 1 Then
GetPW = GetSSPassWord()
Else
GetPW = True
End If
End Function
Function GetSSIniLong& (Entry$, Default&)
Section$ = "Screen Saver." + AppName$
GetSSIniLong& = GetIniLong&("control.ini", Section$, Entry$, Default&)
End Function
Function GetSSIniString$ (Entry$, Default$)
Section$ = "Screen Saver." + AppName$
GetSSIniString$ = GetIniString$("control.ini", Section$, Entry$, Default$)
End Function
Sub HideCursor ()
Do
Loop Until ShowCursor(0) = -1
End Sub
Sub Main ()
If App.PrevInstance Then End
C$ = UCase$(Command$)
If C$ = "/S" Or C$ = "-S" Then
Ok = SystemParametersInfo(SPI_SETSCREENSAVEACTIVE, 0, ByVal 0&, 0)
Load frmSave
HideCursor
InitSave
Else
Load frmConfig
DialogBox frmConfig
frmConfig.Show 1
End If
End Sub
Sub ScreenCapture ()
frmSave.Width = Screen.Width + 15
frmSave.Height = Screen.Height + 15
Ok = DoEvents()
DC = CreateDC("DISPLAY", 0, 0, 0)
ScrnW = GetDeviceCaps(DC, HORZRES)
ScrnH = GetDeviceCaps(DC, VERTRES)
frmSave.AutoRedraw = True
BitBlt frmSave.hDC, 1, 1, ScrnW, ScrnH, DC, 0, 0, &HCC0020
frmSave.AutoRedraw = False
DeleteDC DC
End Sub
Sub SetSSIniLong (Entry$, ByVal Default&)
Section$ = "Screen Saver." + AppName$
SetIniLong "control.ini", Section$, Entry$, Default&
End Sub
Sub SetSSIniString (Entry$, Default$)
Section$ = "Screen Saver." + AppName$
SetIniString "control.ini", Section$, Entry$, Default$
End Sub
Sub UserEvent ()
If TimeToGo Then
Ok = ShowCursor(1)
If GetPW() Then
Ok = SystemParametersInfo(SPI_SETSCREENSAVEACTIVE, 1, ByVal 0&, 0)
CleanUp
Else
HideCursor
End If
TimeToGo = False
Else
TimeToGo = True
End If
End Sub