Solved

Windows Process running

Posted on 2016-08-04
3
55 Views
Last Modified: 2016-08-04
I have inherited a VB.Net Windows form app
It compiles fine
But it was set up so that a Windows Task Scheduler opens it every 15 minutes
Is there a way to see if an instance of the App is already running and if there is > 5 instances.... exit instead of running anything?
0
Comment
Question by:lrbrister
3 Comments
 
LVL 70

Accepted Solution

by:
Éric Moreau earned 500 total points
ID: 41742639
You can use code like this to find out if a process is running:
Public Function IsProcessRunning(name As String) As Boolean
    'here we're going to get a list of all running processes on
    'the computer
    For Each clsProcess As Process In Process.GetProcesses()
        If clsProcess.ProcessName.StartsWith(name) Then
            'process found so it's running so return true
            Return True
        End If
    Next
    'process not found, return false
    Return False
End Function

Open in new window

0
 
LVL 21

Expert Comment

by:Randy Poole
ID: 41742655
You can edit your project properties and on the application tab, check the 'Make single instance application' checkbox
0
 

Author Closing Comment

by:lrbrister
ID: 41742665
Eric
You had the best answer to my specific request > 5
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
ASP.NET MVC 2 32
Creating a route in asp.net webforms 2 30
cannot connect to sqlserver 8 30
vb.net class 3 17
For a while now I'v been searching for a circular progress control, much like the one you get when first starting your Silverlight application. I found a couple that were written in WPF and there were a few written in Silverlight, but all appeared o…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…

832 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question