Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Windows Process running

Posted on 2016-08-04
3
Medium Priority
?
88 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 2000 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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

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 article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
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…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

715 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