TITLE:Screen Savers in MultiValue Environment Part 2

ISSUE:Multi-Value Solutions Nov'98

AUTHOR:Nathan Rector

COMPANY:Natec Systems

EMAIL:nater@northcoast.com

HTTP:www.northcoast.com/~nater/

Last month 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.

Last month I covered the core code of the screen saver. This month I'll talk about visual aspect of the screen saver and the user interface.

I'll start with the Login dialog box that is displayed when the user touch a key or moves the mouse. This example uses a form called frmLogin that looks like the following:

{show picture of login box}

Here is what the controls do:

txtUserName and txtPassword are obvious. They ask the user for the login information.

Status shows the status of the users login.

cmdOk and cmdCancel are your Windows defaults for what to do.

Timer1 is the one control that isn't really clear what it does. The Timer control is used to cause the dialog box to close if nothing has happened after a period of time.

There are a few internal variables and routines that is needed in the form. The method CheckLogin is used to do the actual valiation of the user name and password on the MultiValue Host.

The variable LoginSucceeded is used by the main screen saver routines to see if the user name and password were valid and if the screen saver should continue to run or if it should shut down.

The following code is what is found behind the actual Login Dialog form. Please note that his screen saver was originally designed to work with Pic-Lan. By changing the code in CheckLogin, you can cause the Login Dialog to pull information from anywhere you wish.

Option Explicit

Dim PicLan As New Plan

Public LoginSucceeded As Boolean

Public ErrMsg As String

Private Sub cmdCancel_Click()

'set the global var to false

'to denote a failed login

LoginSucceeded = False

Me.Hide

End Sub

Private Sub cmdOK_Click()

'check for correct password

If txtPassword = "pic-lan screensaver" Then

'place code to here to pass the

'success to the calling sub

'setting a global var is the easiest

LoginSucceeded = True

Me.Hide

ElseIf CheckLogin Then

LoginSucceeded = True

Me.Hide

Else

Beep

frmLogin.Height = 2505

Status = "Invalid Password, try again!" & vbCrLf & ErrMsg

txtPassword.SetFocus

SendKeys "{Home}+{End}"

End If

End Sub

Private Sub Form_Load()

LoginSucceeded = False

frmLogin.Height = 1635

End Sub

Private Sub Timer1_Timer()

LoginSucceeded = False

frmLogin.Height = 1635

Me.Hide

End Sub

Public Function CheckLogin() As Boolean

Dim EmpFile As Integer

Dim ErrNo As Integer

Dim EmpItem As String

Dim EmpPassword As String

' this routine is used to check to make sure that the

' person logining in is a valid user

CheckLogin = False

On Error GoTo ErrorHandler

' Opens the employee file

EmpFile = PicLan.FileOpen("APMAIN", "TCR", "EMP")

If EmpFile <= 0 Then

' error

ErrMsg = PicLan.ErrorStr(EmpFile)

GoTo ExitSub

End If

' Checks to see if the employee exists. If not, then

' login error

ErrNo = PicLan.ItemRead(EmpFile, txtUserName, EmpItem)

If ErrNo = PLAN_NOT_ON_FILE Then

ErrMsg = "" 'txtUserName & " does not exist"

GoTo CloseFile

ElseIf ErrNo < 0 Then

' employee number does not exist

ErrMsg = PicLan.ErrorStr(EmpFile)

GoTo CloseFile

End If

' checks password

EmpPassword = PicLan.DynExtract(EmpItem, 49, 1, 1)

If EmpPassword = txtPassword Then

' ok Passwords match

ErrMsg = "" '"Password does not match"

CheckLogin = True

Else

' error. Password wrong

End If

CloseFile:

' close file

ErrNo = PicLan.FileClose(EmpFile)

If ErrNo <= 0 Then

' error

End If

ExitSub:

' terminates

Set PicLan = Nothing

Exit Function

ErrorHandler:

ErrMsg = Err.Description

Exit Function

End Function

TITLE:Screen Savers in MultiValue Environment Part 2

TITLE:Screen Savers in MultiValue Environment Part 2

ISSUE:Multi-Value Solutions Nov'98

AUTHOR:Nathan Rector

COMPANY:Natec Systems

EMAIL:nater@northcoast.com

HTTP:www.northcoast.com/~nater/

Last month 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.

Last month I covered the core code of the screen saver. This month I'll talk about visual aspect of the screen saver and the user interface.

I'll start with the Login dialog box that is displayed when the user touch a key or moves the mouse. This example uses a form called frmLogin that looks like the following:

{show picture of login box}

Here is what the controls do:

txtUserName and txtPassword are obvious. They ask the user for the login information.

Status shows the status of the users login.

cmdOk and cmdCancel are your Windows defaults for what to do.

Timer1 is the one control that isn't really clear what it does. The Timer control is used to cause the dialog box to close if nothing has happened after a period of time.

There are a few internal variables and routines that is needed in the form. The method CheckLogin is used to do the actual valiation of the user name and password on the MultiValue Host.

The variable LoginSucceeded is used by the main screen saver routines to see if the user name and password were valid and if the screen saver should continue to run or if it should shut down.

The following code is what is found behind the actual Login Dialog form. Please note that his screen saver was originally designed to work with Pic-Lan. By changing the code in CheckLogin, you can cause the Login Dialog to pull information from anywhere you wish.

Option Explicit

Dim PicLan As New Plan

Public LoginSucceeded As Boolean

Public ErrMsg As String

Private Sub cmdCancel_Click()

'set the global var to false

'to denote a failed login

LoginSucceeded = False

Me.Hide

End Sub

Private Sub cmdOK_Click()

'check for correct password

If txtPassword = "pic-lan screensaver" Then

'place code to here to pass the

'success to the calling sub

'setting a global var is the easiest

LoginSucceeded = True

Me.Hide

ElseIf CheckLogin Then

LoginSucceeded = True

Me.Hide

Else

Beep

frmLogin.Height = 2505

Status = "Invalid Password, try again!" & vbCrLf & ErrMsg

txtPassword.SetFocus

SendKeys "{Home}+{End}"

End If

End Sub

Private Sub Form_Load()

LoginSucceeded = False

frmLogin.Height = 1635

End Sub

Private Sub Timer1_Timer()

LoginSucceeded = False

frmLogin.Height = 1635

Me.Hide

End Sub

Public Function CheckLogin() As Boolean

Dim EmpFile As Integer

Dim ErrNo As Integer

Dim EmpItem As String

Dim EmpPassword As String

' this routine is used to check to make sure that the

' person logining in is a valid user

CheckLogin = False

On Error GoTo ErrorHandler

' Opens the employee file

EmpFile = PicLan.FileOpen("APMAIN", "TCR", "EMP")

If EmpFile <= 0 Then

' error

ErrMsg = PicLan.ErrorStr(EmpFile)

GoTo ExitSub

End If

' Checks to see if the employee exists. If not, then

' login error

ErrNo = PicLan.ItemRead(EmpFile, txtUserName, EmpItem)

If ErrNo = PLAN_NOT_ON_FILE Then

ErrMsg = "" 'txtUserName & " does not exist"

GoTo CloseFile

ElseIf ErrNo < 0 Then

' employee number does not exist

ErrMsg = PicLan.ErrorStr(EmpFile)

GoTo CloseFile

End If

' checks password

EmpPassword = PicLan.DynExtract(EmpItem, 49, 1, 1)

If EmpPassword = txtPassword Then

' ok Passwords match

ErrMsg = "" '"Password does not match"

CheckLogin = True

Else

' error. Password wrong

End If

CloseFile:

' close file

ErrNo = PicLan.FileClose(EmpFile)

If ErrNo <= 0 Then

' error

End If

ExitSub:

' terminates

Set PicLan = Nothing

Exit Function

ErrorHandler:

ErrMsg = Err.Description

Exit Function

End Function