Solved

Checking for a process..

Posted on 2000-04-13
5
161 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
Comment Utility
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
Comment Utility
Thanks! It works great..

Ian
0
 
LVL 32

Expert Comment

by:Erick37
Comment Utility
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
Comment Utility
That was quick!
0
 
LVL 142

Expert Comment

by:Guy Hengel [angelIII / a3]
Comment Utility
Faster than my shadow ....
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

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 …
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 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 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…

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

13 Experts available now in Live!

Get 1:1 Help Now