You are on page 1of 63

Process Authentication for High System Assurance

ABSTRACT
The project Process Authentication for High System Assurance
is designed using Microsoft Visual Studio.Net 2003 as front end and
Microsoft SQL Server 2000 as back end which works in .Net framework version
1.1. The coding language used is Visual Basic .Net.
The project is deigned to monitor the processes running in the system, kill
any unwanted process. The processed, duration the process ran, etc are the details
that can be viewed.
In addition, any process may be add/remove in/from the database and
configured i.e., limited such as how many times the process would run in a day, at
a time and maximum duration the process could run.
Moreover, the application is capable of logoff, restart and shutdown the
system. When the set the time in hibernation, the system hibernates and restarts
after the given time.

TABLE OF CONTENTS
CHAPTER NO

TITLE
ABSTRACT

1.

INTRODUCTION
1.1 ABOUT THE ORGANIZATION
1.2

2.

PROJECT DESCRIPTION

SYSTEM STUDY
2.1 FEASABILITY STUDY
2.2 EXISTING SYSTEM
2.3 PROPOSED SYSTEM

SYSTEM SPECIFICATION
3.1 SOFTWARE REQUIREMENTS
3.2 HARDWARE REQUIREMENTS

LANGUAGE SPECIFICATION
4.1 FEATURES OF VB .NET
4.2 FEATURES OF SQL SERVER 2000

SYSTEM DESIGN
5.1 INPUT DESIGN
5.2 OUTPUT DESIGN
5.3 DATABASE DESIGN
5.4 DATA FLOW DIAGRAM

PAGE NO

SYSTEM TESTING AND MAINTENANCE


6.1 UNIT TESTING
6.2 INTEGRATION TESTING
6.3 VALIDATION TESTING

SYSTEM IMPLEMENTATION
7.1 SCOPE FOR FUTURE DEVELOPMENT

CONCLUSION

BIBLIOGRAPHY
APPENDIX

SCREEN SHOT

DATA TABLE STRUCTURE

SAMPLE CODING

1. INTRODUCTION

1.2 PROJECT DESCRIPTION


The software is divided into two projects from which the first one is for altering
the options. The other will be added in the windows schedule so that the application is
getting automatically started when the user logins to the windows. The backup
application is minimized and running as a task in the operating system.
The project titled PROCESS MONITOR CONTROL contains 5 modules.
1. Processes
2. Time settings
3. System process
4. Process control
5. Process view
6. Process Authentication
1. Processes:
This module is mainly based on database. We can add the process to database for
backup, and also remove the process from the database. List of the process in the
database also can show by this module. This module is made for database purpose.
2. Time settings:
Here we can set the limit for number of process running per the day. By this,
we provide the process that running many times per the day. Also can set the number

of (limit the) process that running at same time. By this, protect the run time error.
From this module we can set the time limit for process running.

3. System process:
In this module, we are controlling the system. Set the time for when we want to
turnoff, logoff, restart the system. Also to set the time for hibernate the system. By this
we can restart the system automatically. Here we select any one of the above options and
set the time for that.
4. Process control:
In this module we are set the time for running the process. In this we can select
the time for instance, after, or set some time. Simultaneously we are set the time for
closing the process.
5. Process view:
In this process view module we are shown the current running process and all
the process. And also shown the total number of process, number of threads, and number
of handles.

2. SYSTEM STUDY
2.1 FEASIBILITY STUDY:
The feasibility of the project is analyzed in this phase and business
proposal is put forth with a very general plan for the project and some cost estimates.
During system analysis the feasibility study of the proposed system is to be carried out.
This is to ensure that the proposed system is not a burden to the company. For feasibility
analysis, some understanding of the major requirements for the system is essential.
Three key considerations involved in the feasibility analysis are
ECONOMICAL FEASIBILITY
TECHNICAL FEASIBILITY
SOCIAL FEASIBILITY
ECONOMICAL FEASIBILITY:
This study is carried out to check the economic impact that the system will
have on the organization. The amount of fund that the company can pour into the
research and development of the system is limited. The expenditures must be justified.
Thus the developed system as well within the budget and this was achieved because most
of the technologies used are freely available. Only the customized products had to be
purchased.

TECHNICAL FEASIBILITY:
This study is carried out to check the technical feasibility, that is, the
technical requirements of the system. Any system developed must not have a high
demand on the available technical resources. This will lead to high demands on the
available technical resources. This will lead to high demands being placed on the client.
The developed system must have a modest requirement, as only minimal or null changes
are required for implementing this system.
SOCIAL FEASIBILITY:
The aspect of study is to check the level of acceptance of the system by the
user. This includes the process of training the user to use the system efficiently. The user
must not feel threatened by the system, instead must accept it as a necessity. The level of
acceptance by the users solely depends on the methods that are employed to educate the
user about the system and to make him familiar with it. His level of confidence must be
raised so that he is also able to make some constructive criticism, which is welcomed, as
he is the final user of the system.
2.2 EXISTING SYSTEM
The task manager is the existing system that is using now for some of the options
in process monitor control. By this task manager we cant set the time for opening or
closing the running process. Also cant set the time for shut down, restart, logoff,
hibernate the system. We cannot able to shown the number of process count, number of
threads count and number of handles.

Drawbacks of existing system:


1. Time setting for closing or opening the process is not possible.
2. Time setting for shutdown, logoff, restart, & hibernate the system is not
possible.
3. Cannot shown or view the number of process, threads, and handles.
4. Also, cant set the maximum instance per day.
2.3 NEED FOR PROPOSED SYSTEM
To avoid the drawbacks in the existing system, the proposed system is designed.
By this proposed system we can set the maximum instance per day. To protect the system
in run time error, we need to set the time for closing the process. So in this time we need
for proposed system.
The advantages of proposed system are
1. Time setting for closing or opening the process is possible
2. Time setting for shutdown, logoff, restart, & hibernate the system is possible.
3. Able to see or view the number of process, threads, and handles.
4. Also, can set the maximum instance per day.
5. More reliability than existing system.
6. Time consuming is less.

3. SYSTEM SPECIFICATION
3.1 HARDWARE CONFIGURATION

The hardware used for the development of the project is:


PROCESSOR

PENTIUM III 866 MHz

RAM

128 MD SD RAM

MONITOR

15 COLOR

HARD DISK

20 GB

FLOPPY DRIVE

1.44 MB

CDDRIVE

LG 52X

KEYBOARD

STANDARD 102 KEYS

MOUSE

3 BUTTONS

3.2 SOFTWARE CONFIGURATION

The software used for the development of the project is:


OPERATING SYSTEM

Windows 2000 Professional

ENVIRONMENT

Visual Studio .NET 2003

.NET FRAMEWORK

Version 1.1

LANGUAGE

Visual Basic.NET

BACKEND

SQL SERVER 2000

4. LANGAUGE SPECIFICATION
4.1 FEATURES OF VISUAL BASIC. NET
Visual Basic. NET, the latest version of visual basic, includes many new features.
The Visual Basic supports interfaces but not implementation inheritance.
Visual basic.net supports implementation inheritance, interfaces and overloading.
In addition, Visual Basic .NET supports multithreading concept.
COMMON LANGUAGE SPECIFICATION (CLS):
Visual Basic.NET is also compliant with CLS (Common Language Specification)
and supports structured exception handling. CLS is set of rules and constructs that are
supported by the CLR (Common Language Runtime). CLR is the runtime environment
provided by the .NET Framework; it manages the execution of the code and also makes
the development process easier by providing services.
Visual Basic.NET is a CLS-compliant language. Any objects, classes, or
components that created in Visual Basic.NET can be used in any other CLS-compliant
language. In addition, we can use objects, classes, and components created in other CLScompliant languages in Visual Basic.NET .The use of CLS ensures complete
interoperability among applications, regardless of the languages used to create the
application.

IMPLEMENTATION INHERITANCE:
Visual Basic.NET supports implementation inheritance. This means that, while
creating applications in Visual Basic.NET, we can drive from another class, which is
know as the base class that derived class inherits all the methods and properties of the

base class. In the derived class, we can either use the existing code of the base class or
override the existing code. Therefore, with help of the implementation inheritance, code
can be reused.

CONSTRUCTORS AND DESTRUCTORS:


Constructors are used to initialize objects, whereas destructors are used to
destroy them. In other words, destructors are used to release the resources allocated to the
object. In Visual Basic.NET the sub finalize procedure is available. The sub finalize
procedure is used to complete the tasks that must be performed when an object is
destroyed. The sub finalize procedure is called automatically when an object is destroyed.
In addition, the sub finalize procedure can be called only from the class it belongs to or
from derived classes.
GARBAGE COLLECTION:
Garbage Collection is another new feature in Visual Basic.NET. The .NET
Framework monitors allocated resources, such as objects and variables. In addition,
the .NET Framework automatically releases memory for reuse by destroying objects that
are no longer in use. In Visual Basic.NET, the garbage collector checks for the objects
that are not currently in use by applications. When the garbage collector comes across an
object that is marked for garbage collection, it releases the memory occupied by the
object.
OVERLOADING:
Overloading is another feature in Visual Basic.NET. Overloading enables us to
define multiple procedures with the same name, where each procedure has a different set
of arguments. Besides using overloading for procedures, we can use it for constructors
and properties in a class.

MULTITHREADING:
Visual Basic.NET also supports multithreading. An application that supports
multithreading can handle multiple tasks simultaneously, we can use multithreading to
decrease the time taken by an application to respond to user interaction. To decrease the
time taken by an application to respond to user interaction, we must ensure that a separate
thread in the application handles user interaction.
STRUCTURED EXCEPTION HANDLING:
Visual Basic.NET supports structured handling, which enables us to detect and
remove errors at runtime. In Visual Basic.NET, we need to use TryCatchFinally
statements to create exception handlers. Using TryCatchFinally statements, we can
create robust and effective exception handlers to improve the performance of our
application.

THE .NET FRAMEWORK:


The .NET Framework is a new computing platform that simplifies application
development in the highly distributed environment of the Internet.
OBJECTIVES OF. NET FRAMEWORK:
1. To provide a consistent object-oriented programming environment whether
object codes is stored and executed locally on Internet-distributed, or executed remotely.
2. To provide a code-execution environment to minimizes software deployment
and guarantees safe execution of code.
3. Eliminates the performance problems.

There are different types of application, such as Windows-based applications and


Web-based applications.
To make communication on distributed environment to ensure that code be
accessed by the .NET Framework can integrate with any other code.
VISUAL STUDIO .NET:
Visual Studio .NET is a complete set of development tools for building
ASP Web applications, XML Web services, desktop applications, and mobile applications
In addition to building high-performing desktop applications, you can use Visual Studio's
powerful component-based development tools and other technologies to simplify teambased design, development, and deployment of Enterprise solutions.
Visual Basic .NET, Visual C++ .NET, and Visual C# .NET all use the same
integrated development environment (IDE), which allows them to share tools and
facilitates in the creation of mixed-language solutions. In addition, these languages
leverage the functionality of the .NET Framework and simplify the development of ASP
Web applications and XML Web services.
Visual Studio supports the .NET Framework, which provides a common language
runtime and unified programming classes; ASP.NET uses these components to create
ASP Web applications and XML Web services. Also it includes MSDN Library, which
contains all the documentation for these development tools.

4.2 FEATURES OF SQL-SERVER


The OLAP Services feature available in SQL Server version 7.0 is now called
SQL Server 2000 Analysis Services. The term OLAP Services has been replaced with the
term Analysis Services. Analysis Services also includes a new data mining component.
The Repository component available in SQL Server version 7.0 is now called Microsoft
SQL Server 2000 Meta Data Services. References to the component now use the term
Meta Data Services. The term repository is used only in reference to the repository engine
within Meta Data Services
SQL-SERVER database consist of six type of objects,
They are,
1. TABLE
2. QUERY
3. FORM
4. REPORT
5. MACRO
TABLE:
A database is a collection of data about a specific topic.
VIEWS OF TABLE:
We can work with a table in two types,
1. Design View
2. Datasheet View

Design View
To build or modify the structure of a table we work in the table design view.
We can specify what kind of data will be hold.
Datasheet View
To add, edit or analyses the data itself we work in tables datasheet view
mode.
QUERY:
A query is a question that has to be asked the data. Access gathers data that
answers the question from one or more table. The data that make up the answer is either
dynaset (if you edit it) or a snapshot(it cannot be edited).Each time we run query, we get
latest information in the dynaset.Access either displays the dynaset or snapshot for us to
view or perform an action on it ,such as deleting or updating.
FORMS:
A form is used to view and edit information in the database record by
record .A form displays only the information we want to see in the way we want to see it.
Forms use the familiar controls such as textboxes and checkboxes. This makes viewing
and entering data easy.
Views of Form:
We can work with forms in several primarily there are two views,

They are,
1. Design View
2. Form View

Design View
To build or modify the structure of a form, we work in forms design view.
We can add control to the form that are bound to fields in a table or query, includes
textboxes, option buttons, graphs and pictures.
Form View
The form view which display the whole design of the form.
REPORT:

A report is used to vies and print information from the database. The report
can ground records into many levels and compute totals and average by checking values
from many records at once. Also the report is attractive and distinctive because we have
control over the size and appearance of it.
MACRO:

A macro is a set of actions. Each action in macros does something. Such as


opening a form or printing a report .We write macros to automate the common tasks the
work easy and save the time.
MODULE:

Modules are units of code written in access basic language. We can write and
use module to automate and customize the database in very sophisticated ways.

5. SYSTEM DESIGN
5.1 INPUT DESIGN
Input design is the process of converting user-originated inputs to a
computer-based format. Input design is one of the most expensive phases of the operation
of computerized system and is often the major problem of a system.
In the project, the schedule selection page is made with several easy to use
options.
Add process:
This screen is used to get the process name for add and save the process to
database.
Remove process:
This screen is used to get the process name for remove the process from the
database.
Time settings for process:
This screen is used to get the time setting for allow maximum instance per
the day, allow maximum instance at a time and instance running time limit.

Time settings for system:


This screen is used to get the time setting for shutdown, logoff, restart, and
hibernate the system.

Running process:
This screen is used to get the time setting for opening and closing the
process in the system.
5.2 OUTPUT DESIGN

Output design generally refers to the results and information that are generated by
the system for many end-users; output is the main reason for developing the system and
the basis on which they evaluate the usefulness of the application.
The output is designed in such a way that it is attractive, convenient and
informative. Forms are designed in VB.NET with various features, which make the
console output more pleasing.
As the outputs are the most important sources of information to the users, better
design should improve the systems relationships with us and also will help in decisionmaking. Form design elaborates the way output is presented and the layout available for
capturing information.
Process:
This report shows the process path and process name from the database.
Also shoes the number of process running, number of threads, and number of handles.
5.3 DATABASE DESIGN
In the database design relationship between the database is decided.
Database is defined as collection of interrelated data stored together with controlled
redundancy to serve one or more application in optional fashion.

5.4 DATA FLOW DIAGRAM


Processes

Add

Processes

Processes
Rem
ove

Sho
w picture list

Settings

Allow

max

maxlimitperday

instance per day

Settings
Allow

max

instance per time

Maxlimitat a
time

System
Insurance

maxrunninglimit

running time limit

Shut

down

after

Logoff after
Processes
System
Restart after

Hibernate

Run

Run a task after

Close task after

Run task at
Run
Close task at

Run task now

Close task now

View

Process log

Current
running process

Processes

Process

View

count

Thread count

Handles
count

About

About

About
software

5.5 SYSTEM FLOW DIAGRAM

PROCESSMC

Login

Processes

Add process

Time Settings

AllowMax

SYSTEM

RUN

VIEW

Shutdown

Run task after

Process log

Logoff

Close task after

Current

InstancePer day

Remove pro

AllowMax

Instance

running

processes

At a time

Show proc

Restart

Run task at

Process count

Hibernate

Close task at

Thread count

Instance running
Time Limit

Run task now

Close task now

Handles count

6. SYSTEM TESTING AND MAINTENANCE

Testing is vital to the success of the system. System testing makes a logical
assumption that if all parts of the system are correct, the goal will be successfully
achieved. In the testing process we test the actual system in an organization and gather
errors from the new system operates in full efficiency as stated. System testing is the
stage of implementation, which is aimed to ensuring that the system works accurately and
efficiently.
In the testing process we test the actual system in an organization and gather
errors from the new system and take initiatives to correct the same. All the front-end and
back-end connectivity are tested to be sure that the new system operates in full efficiency
as stated. System testing is the stage of implementation, which is aimed at ensuring that
the system works accurately and efficiently.
The main objective of testing is to uncover errors from the system. For the
uncovering process we have to give proper input data to the system. So we should have
more conscious to give input data. It is important to give correct inputs to efficient
testing.
Testing is done for each module. After testing all the modules, the modules are
integrated and testing of the final system is done with the test data, specially designed to
show that the system will operate successfully in all its aspects conditions. Thus the
system testing is a confirmation that all is correct and an opportunity to show the user that
the system works. Inadequate testing or non-testing leads to errors that may appear few
months later. This will create two problems
Time delay between the cause and appearance of the problem.

The effect of the system errors on files and records within the system.
The purpose of the system testing is to consider all the likely variations to which
it will be suggested and push the system to its limits.
The testing process focuses on logical intervals of the software ensuring that all
the statements have been tested and on the function intervals (i.e.,) conducting tests to
uncover errors and ensure that defined inputs will produce actual results that agree with
the required results.
Testing has to be done using the two common steps Unit testing and Integration
testing.
In the project system testing is made as follows:
The procedure level testing is made first. By giving improper inputs, the errors
occurred are noted and eliminated.
This is the final step in system life cycle. Here we implement the tested error-free
system into real-life environment and make necessary changes, which runs in an online
fashion. Here system maintenance is done every months or year based on company
policies, and is checked for errors like runtime errors, long run errors and other
maintenances like table verification and reports.
6.1. UNIT TESTING:
Unit testing verification efforts on the smallest unit of software design,
module. This is known as Module Testing. The modules are tested separately. This
testing is carried out during programming stage itself. In these testing steps, each module
is found to be working satisfactorily as regard to the expected output from the module.

6.2. INTEGRATION TESTING:


Integration testing is a systematic technique for constructing tests to
uncover error associated within the interface. In the project, all the modules are combined
and then the entire programmer is tested as a whole. In the integration-testing step, all the
error uncovered is corrected for the next testing steps.

6.3. VALIDATION TESTING:


To uncover functional errors, that is, to check whether functional
characteristics confirm to specification or not
MAINTENANCE:
The objectives of this maintenance work are to make sure that the system
gets into work all time without any bug. Provision must be for environmental changes
which may affect the computer or software system. This is called the maintenance of the
system. Nowadays there is the rapid change in the software world. Due to this rapid
change, the system should be capable of adapting these changes. In our project the
process can be added without affecting other parts of the system.
Maintenance plays a vital role. The system liable to accept any
modification after its implementation. This system has been designed to favor all new
changes. Doing this will not affect the systems performance or its accuracy.

7. SYSTEM IMPLEMENTATION
Implementation is the stage of the project when the theoretical design is
turned out into a working system. Thus it can be considered to be the most critical stage
in achieving a successful new system and in giving the user, confidence that the new
system will work and be effective.
The implementation stage involves careful planning, investigation of the
existing system and its constraints on implementation, designing of methods to achieve
changeover and evaluation of changeover methods.
Implementation is the process of converting a new system design into
operation. It is the phase that focuses on user training, site preparation and file conversion
for installing a candidate system. The important factor that should be considered here is
that the conversion should not disrupt the functioning of the organization.
7.1 SCOPE FOR FUTURE ENHANCEMENTS
The project has covered almost all the requirements. Further
requirements and improvements can easily be done since the coding is mainly structured
or modular in nature. Improvements can be appended by changing the existing modules
or adding new modules. One important development that can be added to the project in
future is file level backup, which is presently done for folder level.

8. CONCLUSION
It is concluded that the application works well and satisfy the needs.The
application is tested very well and errors are properly debugged. It is designed to monitor
the processes running in the system, Kill any unwanted process. The processed, duration
the process ran, etc are the details that can be viewed.
In addition, any process may be add/remove in/from the database and configured
i.e., limited such as how many times the process would run in a day, at a time and
maximum duration the process could run.
Moreover, the application is capable of logoff, restart and shutdown the system.
When the set the time in hibernation, the system hibernates and restarts after the given
time.

9. BIBLIOGRAPHY

Microsoft Visual Basic.NET Programmers Cookbook:


-MATTHEW MACDONALD
(Tata McGraw-Hill Edition)
Grey Buczek, .NET developers guide 2002, Prentice-Hall India.
Benolt Marchal, VB.NET by example 2003 TataMcGraw- Hill.
System Analysis & Design Alenis Leon.
An Integral approach to software engineering Pankaj Jalole.

APPENDIX:
SCREENS SHOTS:

TABLE STRUCTURE

MaxLimitAtatime(PrimaryKey:SNo)

MaxLimitPerDay(PrimaryKey:SNo)

MaxRunningLimit (PrimaryKey:SNo)

Processes(PrimaryKey:ProcessPath,ProcessName)

ProcessLog(PrimaryKey:SNo)

SAMPLE CODING:
FORM ADD PROCESS:
Imports System.DATA.SQLCLIENT
Public Class frmAddProcess
Inherits System.Windows.Forms.Form
Dim con As New SQLConnection
Dim cmd As New SqlCommand
Dim da As New SqlDataAdapter(cmd)
Dim ds As New DataSet
#Region " Windows Form Designer generated code "
Public Sub New()
MyBase.New()
'This call is required by the Windows Form Designer.
InitializeComponent()
'Add any initialization after the InitializeComponent() call
End Sub
'Form overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer
Friend WithEvents Button1 As System.Windows.Forms.Button
Friend WithEvents Label1 As System.Windows.Forms.Label
Friend WithEvents TextBox1 As System.Windows.Forms.TextBox
Friend WithEvents OFD As System.Windows.Forms.OpenFileDialog
Friend WithEvents TextBox2 As System.Windows.Forms.TextBox
Friend WithEvents Button2 As System.Windows.Forms.Button

Friend WithEvents Label2 As System.Windows.Forms.Label


Friend WithEvents Button3 As System.Windows.Forms.Button
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Me.Button1 = New System.Windows.Forms.Button
Me.Label1 = New System.Windows.Forms.Label
Me.TextBox1 = New System.Windows.Forms.TextBox
Me.OFD = New System.Windows.Forms.OpenFileDialog
Me.TextBox2 = New System.Windows.Forms.TextBox
Me.Button2 = New System.Windows.Forms.Button
Me.Label2 = New System.Windows.Forms.Label
Me.Button3 = New System.Windows.Forms.Button
Me.SuspendLayout()
'
'Button1
'
Me.Button1.Location = New System.Drawing.Point(184, 80)
Me.Button1.Name = "Button1"
Me.Button1.TabIndex = 7
Me.Button1.Text = "&Select"
'
'Label1
'
Me.Label1.Location = New System.Drawing.Point(8, 16)
Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing.Size(112, 23)
Me.Label1.TabIndex = 5
Me.Label1.Text = "Select Process Path"
'
'TextBox1
'
Me.TextBox1.Enabled = False
Me.TextBox1.Location = New System.Drawing.Point(8, 40)
Me.TextBox1.Name = "TextBox1"
Me.TextBox1.Size = New System.Drawing.Size(464, 20)
Me.TextBox1.TabIndex = 6
Me.TextBox1.Text = ""
'
'OFD
'
Me.OFD.DefaultExt = "EXE"
Me.OFD.Filter = "Executable Files (*.exe) | *exe"
Me.OFD.FilterIndex = 0
'
'TextBox2
'
Me.TextBox2.Enabled = False

Me.TextBox2.Location = New System.Drawing.Point(8, 104)


Me.TextBox2.Name = "TextBox2"
Me.TextBox2.Size = New System.Drawing.Size(112, 20)
Me.TextBox2.TabIndex = 8
Me.TextBox2.Text = ""
'
'Button2
'
Me.Button2.Location = New System.Drawing.Point(112, 176)
Me.Button2.Name = "Button2"
Me.Button2.TabIndex = 9
Me.Button2.Text = "Sa&ve"
'
'Label2
'
Me.Label2.Location = New System.Drawing.Point(8, 72)
Me.Label2.Name = "Label2"
Me.Label2.Size = New System.Drawing.Size(112, 23)
Me.Label2.TabIndex = 10
Me.Label2.Text = "Process Name"
'
'Button3
'
Me.Button3.Location = New System.Drawing.Point(200, 176)
Me.Button3.Name = "Button3"
Me.Button3.TabIndex = 11
Me.Button3.Text = "&Close"
'
'frmAddProcess
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(536, 341)
Me.Controls.Add(Me.Button3)
Me.Controls.Add(Me.Label2)
Me.Controls.Add(Me.Button2)
Me.Controls.Add(Me.TextBox2)
Me.Controls.Add(Me.Label1)
Me.Controls.Add(Me.TextBox1)
Me.Controls.Add(Me.Button1)
Me.Name = "frmAddProcess"
Me.Text = "AddProcess"
Me.ResumeLayout(False)
End Sub
#End Region

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Button1.Click
OFD.ShowDialog()
TextBox1.Text = OFD.FileName
TextBox2.Text = Mid(OFD.FileName, OFD.FileName.LastIndexOf("\") + 2)
End Sub
Private Sub frmAddProcess_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
con.ConnectionString = Constr
cmd.CommandText = "Select * from Processes"
cmd.Connection = con
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button2.Click
con.Open()
Try
If TextBox2.Text.ToUpper.EndsWith(".EXE") Then
TextBox2.Text = Mid(TextBox2.Text, 1, Len(TextBox2.Text) - 4)
End If
cmd.CommandText = "insert into processes values ('" & TextBox1.Text & "','" &
Trim(TextBox2.Text) & "')"
cmd.ExecuteNonQuery()
MsgBox("Saved...", MsgBoxStyle.Information)
Catch ex As Exception
MsgBox(ex.Message.ToString, MsgBoxStyle.Critical)
Finally
con.Close()
End Try

End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button3.Click
Me.Close()
End Sub

Private Sub frmAddProcess_Closing(ByVal sender As Object, ByVal e As


System.ComponentModel.CancelEventArgs) Handles MyBase.Closing
'On Error Resume Next
' con.Close()
End Sub
Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles TextBox1.TextChanged
End Sub
Private Sub TextBox2_TextChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles TextBox2.TextChanged
End Sub
Private Sub Label1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Label1.Click
End Sub
End Class
SETTINGS:
Imports System.DATA.SQLCLIENT
Public Class frmMaxInstPerDay
Inherits System.Windows.Forms.Form
#Region " Windows Form Designer generated code "
Public Sub New()
MyBase.New()
'This call is required by the Windows Form Designer.
InitializeComponent()
'Add any initialization after the InitializeComponent() call
End Sub
'Form overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()

End If
End If
MyBase.Dispose(disposing)
End Sub
'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
Friend WithEvents DataGridTableStyle1 As
System.Windows.Forms.DataGridTableStyle
Friend WithEvents DataGridTextBoxColumn1 As
System.Windows.Forms.DataGridTextBoxColumn
Friend WithEvents DataGrid1 As System.Windows.Forms.DataGrid
Friend WithEvents DataGridTextBoxColumn2 As
System.Windows.Forms.DataGridTextBoxColumn
Friend WithEvents ListBox1 As System.Windows.Forms.ListBox
Friend WithEvents Button1 As System.Windows.Forms.Button
Friend WithEvents Label1 As System.Windows.Forms.Label
Friend WithEvents TextBox1 As System.Windows.Forms.TextBox
Friend WithEvents Button2 As System.Windows.Forms.Button
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Me.DataGridTableStyle1 = New System.Windows.Forms.DataGridTableStyle
Me.DataGrid1 = New System.Windows.Forms.DataGrid
Me.DataGridTextBoxColumn1 = New
System.Windows.Forms.DataGridTextBoxColumn
Me.DataGridTextBoxColumn2 = New
System.Windows.Forms.DataGridTextBoxColumn
Me.ListBox1 = New System.Windows.Forms.ListBox
Me.Button1 = New System.Windows.Forms.Button
Me.Label1 = New System.Windows.Forms.Label
Me.TextBox1 = New System.Windows.Forms.TextBox
Me.Button2 = New System.Windows.Forms.Button
CType(Me.DataGrid1, System.ComponentModel.ISupportInitialize).BeginInit()
Me.SuspendLayout()
'
'DataGridTableStyle1
'
Me.DataGridTableStyle1.DataGrid = Me.DataGrid1
Me.DataGridTableStyle1.GridColumnStyles.AddRange(New
System.Windows.Forms.DataGridColumnStyle() {Me.DataGridTextBoxColumn1,
Me.DataGridTextBoxColumn2})
Me.DataGridTableStyle1.HeaderForeColor =
System.Drawing.SystemColors.ControlText

Me.DataGridTableStyle1.MappingName = ""
Me.DataGridTableStyle1.PreferredColumnWidth = 400
Me.DataGridTableStyle1.ReadOnly = True
'
'DataGrid1
'
Me.DataGrid1.DataMember = ""
Me.DataGrid1.HeaderForeColor = System.Drawing.SystemColors.ControlText
Me.DataGrid1.Location = New System.Drawing.Point(240, 16)
Me.DataGrid1.Name = "DataGrid1"
Me.DataGrid1.Size = New System.Drawing.Size(440, 192)
Me.DataGrid1.TabIndex = 1
Me.DataGrid1.TableStyles.AddRange(New
System.Windows.Forms.DataGridTableStyle() {Me.DataGridTableStyle1})
'
'DataGridTextBoxColumn1
'
Me.DataGridTextBoxColumn1.Format = ""
Me.DataGridTextBoxColumn1.FormatInfo = Nothing
Me.DataGridTextBoxColumn1.MappingName = ""
Me.DataGridTextBoxColumn1.Width = 400
'
'DataGridTextBoxColumn2
'
Me.DataGridTextBoxColumn2.Format = ""
Me.DataGridTextBoxColumn2.FormatInfo = Nothing
Me.DataGridTextBoxColumn2.MappingName = ""
Me.DataGridTextBoxColumn2.Width = 75
'
'ListBox1
'
Me.ListBox1.Location = New System.Drawing.Point(16, 24)
Me.ListBox1.Name = "ListBox1"
Me.ListBox1.Size = New System.Drawing.Size(120, 186)
Me.ListBox1.TabIndex = 2
'
'Button1
'
Me.Button1.Location = New System.Drawing.Point(240, 232)
Me.Button1.Name = "Button1"
Me.Button1.TabIndex = 3
Me.Button1.Text = "Ok"
'
'Label1
'
Me.Label1.Location = New System.Drawing.Point(24, 232)

Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing.Size(128, 23)
Me.Label1.TabIndex = 4
Me.Label1.Text = "Enter Max Limit Per Day"
'
'TextBox1
'
Me.TextBox1.Location = New System.Drawing.Point(160, 232)
Me.TextBox1.Name = "TextBox1"
Me.TextBox1.Size = New System.Drawing.Size(64, 20)
Me.TextBox1.TabIndex = 5
Me.TextBox1.Text = ""
Me.TextBox1.TextAlign = System.Windows.Forms.HorizontalAlignment.Right
'
'Button2
'
Me.Button2.Location = New System.Drawing.Point(320, 232)
Me.Button2.Name = "Button2"
Me.Button2.TabIndex = 6
Me.Button2.Text = "Close"
'
'frmMaxInstPerDay
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(728, 273)
Me.Controls.Add(Me.Button2)
Me.Controls.Add(Me.TextBox1)
Me.Controls.Add(Me.Label1)
Me.Controls.Add(Me.Button1)
Me.Controls.Add(Me.ListBox1)
Me.Controls.Add(Me.DataGrid1)
Me.Name = "frmMaxInstPerDay"
Me.Text = "MaxInstencesPerDay"
CType(Me.DataGrid1, System.ComponentModel.ISupportInitialize).EndInit()
Me.ResumeLayout(False)
End Sub
#End Region
Dim con As New SQLConnection
Dim cmd As New SQLCOMmand
Dim da As New SQLDATAADapter(cmd)
Dim ds As DataSet
Dim r As SQLDATAREader
Dim TableName As String

Private Sub frmMaxInstPerDay_Load(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles MyBase.Load
Select Case MaxType
Case "Per Day"
Me.Text = "Maximum Limit Per Day"
TableName = "MaxLimitPerDay"
Case "At a Time"
Me.Text = "Maximum Limit At a Time"
Label1.Text = "Enter Max Limit at a Time"
TableName = "MaxLimitataTime"
Case "Time Limit"
Me.Text = "Running Time Limit For Process"
Label1.Text = "Enter Max Time Limit (Minutes)"
TableName = "MaxRunningLimit"
End Select
con.ConnectionString = Constr
cmd.CommandText = "Select * from Processes"
cmd.Connection = con
'cmd.ExecuteNonQuery()
Fill()
FillList()
End Sub
Sub FillList()
cmd.CommandText = "Select ProcessName From Processes"
con.Open()
r = cmd.ExecuteReader
ListBox1.Items.Clear()
While r.Read
ListBox1.Items.Add(r(0))
End While
r.Close()
con.Close()
End Sub
Sub Fill()
If Not ds Is Nothing Then ds = Nothing
ds = New DataSet
ds.Tables.Clear()
ds.Clear()
cmd.CommandText = "Select * from Processes"
da.Fill(ds, "Processes")
DataGrid1.DataSource = ds
DataGrid1.DataMember = "Processes"
DataGrid1.Refresh()
End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Button1.Click
If ListBox1.SelectedIndex >= 0 Then
If Val(TextBox1.Text) <= 0 Then
MsgBox("Enter max Iimit", MsgBoxStyle.Information)
Exit Sub
End If
con.ConnectionString = Constr
con.Open()
' cmd.CommandText = "select count(*) from MaxLimit where ProcessName='"
& ListBox1.Text & "'"
' cmd.Connection = con
' If cmd.ExecuteScalar <> 0 Then
cmd.CommandText = "Delete from " & TableName & " where ProcessName='"
& ListBox1.Text & "'"
cmd.Connection = con
cmd.ExecuteNonQuery()
' En() 'd If
Select Case TableName
Case "MaxLimitPerDay", "MaxLimitataTime"
cmd.CommandText = "Insert into " & TableName & "
(ProcessName,MaxLimit) values ('" & ListBox1.Text.ToUpper & "'," &
Val(TextBox1.Text) & ")"
Case "MaxRunningLimit"
cmd.CommandText = "Insert into " & TableName & "
(ProcessName,DurationinMinutes) values ('" & ListBox1.Text.ToUpper & "'," &
Val(TextBox1.Text) & ")"
End Select
cmd.ExecuteNonQuery()
con.Close()
MsgBox("Process Added...", MsgBoxStyle.Information)
Else
MsgBox("Select a Process", MsgBoxStyle.Critical)
End If
End Sub
Private Sub TextBox1_KeyPress(ByVal sender As Object, ByVal e As
System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress
Select Case Asc(e.KeyChar)
Case 48 To 57, 8
Case Else
e.Handled = True
End Select
End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Button2.Click
Me.Close()
End Sub
End Class

RUN TASK:
Imports System.Diagnostics
Public Class frmRunTask
Inherits System.Windows.Forms.Form
#Region " Windows Form Designer generated code "
Public Sub New()
MyBase.New()
'This call is required by the Windows Form Designer.
InitializeComponent()
'Add any initialization after the InitializeComponent() call
End Sub
'Form overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
Friend WithEvents Label1 As System.Windows.Forms.Label
Friend WithEvents TextBox1 As System.Windows.Forms.TextBox

Friend WithEvents OFD As System.Windows.Forms.OpenFileDialog


Friend WithEvents Button1 As System.Windows.Forms.Button
Friend WithEvents Button2 As System.Windows.Forms.Button
Friend WithEvents Button3 As System.Windows.Forms.Button
Friend WithEvents Label3 As System.Windows.Forms.Label
Friend WithEvents TextBox3 As System.Windows.Forms.TextBox
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Me.Label1 = New System.Windows.Forms.Label
Me.TextBox1 = New System.Windows.Forms.TextBox
Me.OFD = New System.Windows.Forms.OpenFileDialog
Me.Button1 = New System.Windows.Forms.Button
Me.Button2 = New System.Windows.Forms.Button
Me.Button3 = New System.Windows.Forms.Button
Me.Label3 = New System.Windows.Forms.Label
Me.TextBox3 = New System.Windows.Forms.TextBox
Me.SuspendLayout()
'
'Label1
'
Me.Label1.Location = New System.Drawing.Point(8, 16)
Me.Label1.Name = "Label1"
Me.Label1.TabIndex = 0
Me.Label1.Text = "Select Task"
'
'TextBox1
'
Me.TextBox1.Enabled = False
Me.TextBox1.Location = New System.Drawing.Point(120, 16)
Me.TextBox1.Name = "TextBox1"
Me.TextBox1.Size = New System.Drawing.Size(464, 20)
Me.TextBox1.TabIndex = 1
Me.TextBox1.Text = ""
'
'OFD
'
Me.OFD.DefaultExt = "EXE"
Me.OFD.Filter = "Executable Files (*.exe) | *exe"
Me.OFD.FilterIndex = 0
'
'Button1
'
Me.Button1.Location = New System.Drawing.Point(120, 40)
Me.Button1.Name = "Button1"
Me.Button1.TabIndex = 4
Me.Button1.Text = "&Select"
'

'Button2
'
Me.Button2.Location = New System.Drawing.Point(120, 112)
Me.Button2.Name = "Button2"
Me.Button2.TabIndex = 5
Me.Button2.Text = "&Run"
'
'Button3
'
Me.Button3.Location = New System.Drawing.Point(200, 112)
Me.Button3.Name = "Button3"
Me.Button3.TabIndex = 6
Me.Button3.Text = "&Cancel"
'
'Label3
'
Me.Label3.Location = New System.Drawing.Point(8, 72)
Me.Label3.Name = "Label3"
Me.Label3.TabIndex = 7
Me.Label3.Text = "Arguments"
'
'TextBox3
'
Me.TextBox3.Location = New System.Drawing.Point(120, 72)
Me.TextBox3.Name = "TextBox3"
Me.TextBox3.Size = New System.Drawing.Size(464, 20)
Me.TextBox3.TabIndex = 8
Me.TextBox3.Text = ""
'
'frmRunTask
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(592, 181)
Me.Controls.Add(Me.TextBox3)
Me.Controls.Add(Me.Label3)
Me.Controls.Add(Me.Button3)
Me.Controls.Add(Me.Button2)
Me.Controls.Add(Me.Button1)
Me.Controls.Add(Me.TextBox1)
Me.Controls.Add(Me.Label1)
Me.Name = "frmRunTask"
Me.Text = "Run Task After"
Me.ResumeLayout(False)
End Sub

#End Region
Private Sub TextBox2_TextChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs)
End Sub
Private Sub TextBox2_KeyPress(ByVal sender As System.Object, ByVal e As
System.Windows.Forms.KeyPressEventArgs)
Select Case Asc(e.KeyChar)
Case 48 To 57, 8
Case Else
e.Handled = True
End Select
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button3.Click
Me.Close()
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button2.Click
If TextBox1.Text = "" Then
MsgBox("Please select valid process name", MsgBoxStyle.Critical)
Exit Sub
End If
PStart = New System.Diagnostics.Process
PStart.StartInfo = New ProcessStartInfo(TextBox1.Text, TextBox3.Text)
PStart.Start()
Me.Close()
End Sub

You might also like