SCRNSAVE: Interesting Title
Remember that only Win 3.1 and WinNT will use this name. Win95 uses the name from the executable file. Remeber to name the file with a .SCR suffix.
Then use a bit of code like the following as your sub main:
Sub Main()
'Stop a second copy of this program from being run concurrently...
'Don't try to use an If/End if for this, your saver will alternate on and off.
If app.PrevInstance Then End
'Check if we are doing a setup by looking at the command line.
If LCase$(Command$) = "/c" Then
FrmSetup.Show 'Setup form
Else
FrmMain.Show ' The main screensaver
End If
End Sub
The FrmSetup form will either display a Help about or allow the user to configure you screensaver.The FrmMain will contain a timer control to control the animation. You can either make this form hidden and draw direct to the screen using API calls or you can maximise this form to hide the rest of the applications. Make sure your Form's Maximized property is set, and that it's Border Style is set to None. Add code the the move mouse, mouse down events, to unload the screensaver.
I like to use the SETCURSOR API call to hide the cursor for this form.
When debugging the screensaver, use the ability to set the command line options to control which part gets activated.
The 32 bit systems are less fussy in identifying screensavers but you can still setup the application title in the form:
SCRNSAVE: Interesting Title
Remember that only WinNT will use this name. Win95 uses the name from the executable file. Remember to compile the file with a .SCR suffix.
Then use a bit of code like the following as your sub main:
Public Sub Main()
'Stop a second copy of this program from being run concurrently...
If App.PrevInstance Then End
'Check if we are doing a setup..
If Left$(LCase$(Command()), 2) = "/c" Or Trim$(Command()) = "" Then
FrmSetup.Show
Exit Sub
End If
If Left(LCase$(Command()), 2) = "/p" Then
' If clever then do preview in the dialog as defined by handle
' Not implemented in this example
Exit Sub ' Do not activate by the attempt to preview
End If
' /A to support changeing of passwords
' Not implemented in this example
FrmMain.Show
End Sub
The FrmSetup form will either display a Help about or allow the user to configure you screensaver.The FrmMain will contain a timer control to control the animation. You can either make this form hidden and draw direct to the screen using API calls or you can maximise this form to hide the rest of the applications. Make sure your Form's Maximized property is set, and that it's Border Style is set to None. Add code for the move mouse, mouse down events, to unload the screensaver.
I like to use the SETCURSOR API call to hide the cursor for this form.
Dim HWndParent as long HWndParent = Val(Right$(Command$, Len(Command$) - 2))
I have not yet had chance to research how the .NET framework interacts with screensavers but as far as I am aware, all the above principles still stand.
Search for books on Amazon.