TITLE:Screen Savers in MultiValue Environment Part 3

ISSUE:Multi-Value Solutions Jan '99

AUTHOR:Nathan Rector

COMPANY:Natec Systems



Two months ago, I started the topic of using a screen saver to help secure a Windows workstation using MultiValue information. With the merging of the MutliValue world into the Windows world, the IS department has lost the once secured and control workstations they had with dumb terminals.

With more and more people learning Windows, there is increasing workstation abuse from both new programs the user has added or changes to the existing system. The once secure accounting computers have become less secure as MutliValue information is finding it's way into spreadsheets that are not saved in the MultiValue Database. Anyone familiar with Windows may be able to get access to these files if the user walks away or just by booting the computer up when accounting personel are not around.

There are many security features built into Windows. Although screen savers are not generally thought of as one, but all screen savers have the option for a password.

The one problem with this password is that it exists on the local machine and is a generic overall password that is easily pass around to other coworkers. It also doesn't allow the you the ability to control the time of the day and the says of the week the user may use the system.

Now imagine having a screen saver that will validate a user name and password against information on the host system. In this article I'm going to show you how to make one. This program will require a little bit of knowledge of Visual Basic as well as Visual Basic hooks into the MutliValue database, eg: Winlink32, Pic-Lan, D3 Objects, or UniObjects.

Two months ago, I covered the core code of the screen saver. Last month, I covered the actual password dialog box and connecting to the MultiValue database for verification. This month I'll talk about looks of the screen saver when it is on and how to install the new program on your system.

The looks over your screen saver is up to you. I have found that a non intrusive black screen with a dark color message scrolling or flashing across the screen is the least distracting.

The screen saver display is generated by the form Savemain. Add a timer control and a label control to this form. Check the background color of the form to the color you wish it to be, and type in the message you want to displayed as part of the screen saver. For example, your company name.


Now we add the code to the form. Since this form will be displayed on top of all other windows, basicly covering the whole screen, you won't be able to do anything until the form is unloaded. Most screen savers will react by just pressing a key or moving the mouse. To do this add the following code to the from Savemain.


Private Firstcall As Integer

Private Sub Form_Click()

If RunMode = RM_NORMAL Then Unload Me

End Sub

Private Sub Form_DblClick()

If RunMode = RM_NORMAL Then Unload Me

End Sub

Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)

If RunMode = RM_NORMAL Then Unload Me

End Sub

Private Sub Form_KeyPress(KeyAscii As Integer)

If RunMode = RM_NORMAL Then Unload Me

End Sub

Private Sub Form_MouseMove(Button As Integer, Shift As Integer, x As Single, Y As Single)

' FirstCall is used to prevent the screen saver from

' exiting the first several times this event occurs. For some

' reason, Windows always fires this event at least once, and

' sometimes more, on program startup. When this happens,

' the screen saver quits immediately!

If RunMode = RM_NORMAL Then

If Firstcall < 10 Then

Firstcall = Firstcall + 1


Unload Me

End If

End If

End Sub

Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)

Dim PWOK As Boolean

' If passwords are turned on and we are not on NT check the password.

If RunMode = RM_NORMAL Then

Firstcall = 0 ' Reset the mouse dampener

ShowCursor True ' Need the cursor for the dialog box

Me.Enabled = False

' gets the login

Load frmLogin

frmLogin.Show vbModal, Me

PWOK = frmLogin.LoginSucceeded

Unload frmLogin

If PWOK = False Then Cancel = True

ShowCursor False ' Get rid of cursor - turn back on if exiting

Me.Enabled = True

End If

End Sub


To cause the label to move around the screen, add the following code into the timer control:



Private Sub Timer1_Timer()

Dim Col As Long

Dim Row As Long

Col = Int(Rnd * Savemain.Width)

Row = Int(Rnd * Savemain.Height)

Label1.Top = Row

Label1.Left = Col

End Sub

Now, if you have been following the last two articles, you have everything you need for a custom screen saver. Now all you need to do is compile the Visual Basic program. When you compile the program, make sure you put use a ".scr" extention instead of an ".exe" extention. If you don't do this, then Windows will not display this as a screen saver program.

{show picture - ss3.bmp}

Now copy this program into the \WINDOWS directory. To install this as the default screen saver, right click on the desktop and go to properties, then go to the screen saver tab. Now have a working custom screen saver that allows you to secure your windows workstation with MultiValue password information.

{show picture -ss32.bmp}