Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Multiple instances

Posted on 1998-12-22
4
Medium Priority
?
196 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
[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
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 80 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

Enroll in October's Free Course of the Month

Do you work with and analyze data? Enroll in October's Course of the Month for 7+ hours of SQL training, allowing you to quickly and efficiently store or retrieve data. It's free for Premium Members, Team Accounts, and Qualified Experts!

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…
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
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…
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…
Suggested Courses

636 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