Solved

Checking for a process..

Posted on 2000-04-13
5
162 Views
Last Modified: 2010-05-02
Hello--

I am wondering if there is a way to check the current running processes to see if a specific file is running? I am wanting to do this so I can prevent my program from running two copies at once.. Or, is there an easier way to do this without creating a temporary file or (preferably) without modifying the registry? Thanks.

Ian
0
Comment
Question by:ianpugh
  • 2
  • 2
5 Comments
 
LVL 142

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 20 total points
ID: 2712185
To check if your Application is already running, check the value of App.PrevInstance
if you want to know if any application is running, i can post API solution...
0
 
LVL 1

Author Comment

by:ianpugh
ID: 2712205
Thanks! It works great..

Ian
0
 
LVL 32

Expert Comment

by:Erick37
ID: 2712207
Check for a previous instance using the App object:

Private Sub Form_Load()
    'This form must be the startup form
    If App.PrevInstance Then End
End Sub

OR:

Sub Main()
    If Not App.PrevInstance Then
        frmMain.Show
    End If
End Sub

Or a more involved approach:

"HOWTO: Prevent Multiple Instances of a 32-bit VB Application"
http://support.microsoft.com/support/kb/articles/Q185/7/30.ASP
0
 
LVL 32

Expert Comment

by:Erick37
ID: 2712215
That was quick!
0
 
LVL 142

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 2712219
Faster than my shadow ....
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
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…
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…

920 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

12 Experts available now in Live!

Get 1:1 Help Now