Solved

Check for app already running

Posted on 2004-10-04
2
163 Views
Last Modified: 2010-05-18
I need my app to check all currently running processes (at app startup) to make sure it isn't already running; and if so, cancel the 2nd run of said app. Can/How do I do that?
0
Comment
Question by:RunBoris
[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
2 Comments
 
LVL 18

Expert Comment

by:Sethi
ID: 12223599
0
 
LVL 32

Accepted Solution

by:
Erick37 earned 125 total points
ID: 12223703
Here is one easy way:

Option Explicit

'
'Add the following code to a Standard Module
'From the menu Project->Project Properties->[Startup Object] select "Sub Main"
'


Sub Main()
    If Not (App.PrevInstance) Then
        frmMain.Show '<< modify to point to your main form
    Else '<<optional
        MsgBox App.EXEName & " is already running", vbInformation Or vbOKOnly, App.Title
    End If
End Sub
0

Featured Post

Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Microsoft Access combo box help 2 57
TT Auto Dashboard 13 104
RUNRMTCMD from AS/400 13 129
Dinamic report to Crosstab query 9 60
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

739 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