Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Check for app already running

Posted on 2004-10-04
2
Medium Priority
?
178 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 32

Accepted Solution

by:
Erick37 earned 500 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…
Suggested Courses

824 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