?
Solved

Checking for a process..

Posted on 2000-04-13
5
Medium Priority
?
170 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 143

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 80 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 143

Expert Comment

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

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

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…
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
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
Course of the Month16 days, 22 hours left to enroll

862 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