Solved

Windows Process running

Posted on 2016-08-04
3
40 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 69

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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
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…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

744 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now