Solved

Check for app already running

Posted on 2004-10-04
2
147 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
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

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

14 Experts available now in Live!

Get 1:1 Help Now