Solved

Windows Process running

Posted on 2016-08-04
3
77 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Use Filtering Commands to Process Files in Linux

Learn how to manipulate data with the help of various filtering commands such as `cat`, `fmt`, `pr`, and others in Linux.

Question has a verified solution.

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

For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
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…
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…

623 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