Solved

Checking for a process..

Posted on 2000-04-13
5
166 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 143

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 143

Expert Comment

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

Featured Post

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Convert VB6 MSXML2.ServerXMLHTTP process to C# 2 81
Prevent checkbox click event occur while editing it in vb6 8 74
vbModal 12 74
Modify Text File with Excel Macro 13 47
I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
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 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…
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…

734 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