Solved

Multiple instances

Posted on 1998-12-22
4
188 Views
Last Modified: 2010-05-03
How do you keep a person from opening several instances
of a program? The previnstance wants an object as the
parameter, not an exe name....
0
Comment
Question by:WPentecost
  • 2
4 Comments
 
LVL 8

Expert Comment

by:MikeP090797
ID: 1452025
IF the program is yours, you need to use the App object, App.PrevInstance
0
 
LVL 3

Expert Comment

by:vmano
ID: 1452026
if you want the EXE name to be passed in as a parameter, then try FindWindow and SetFocus API calls.

vmano


0
 
LVL 2

Accepted Solution

by:
dm_14 earned 20 total points
ID: 1452027
1. Place the following code in your apps Sub Main () or form_load procedure

if App.PrevInstance then
 msgbox "App is already available"
 end
end if

2. Try to run two instances of your app, the above message will be displayed and the program will terminate.

This will prevent a person from running multiple instances of a program.
0
 
LVL 8

Expert Comment

by:MikeP090797
ID: 1452028
didn't I already suggest that?
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 I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

932 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

15 Experts available now in Live!

Get 1:1 Help Now