?
Solved

Instances in Delphi 2

Posted on 1997-07-03
2
Medium Priority
?
201 Views
Last Modified: 2010-04-06
How do I make sure my program will not run another instance of itself?
0
Comment
Question by:Evil
[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 Comments
 
LVL 1

Accepted Solution

by:
Gabor earned 200 total points
ID: 1338148
The easiest way is to use a so called global atom.When your program starts you can look for your unique global atom to determine if your program is already running with then following line:- if GlobalFindAtom('MyProgramsUniqueAtom')=0 then begin    {not running}    {Let's make the atom, because this instance is the first}    GlobalAddAtom('MyProgramsUniqueAtom');  end else begin    {running}    {You can close your current instace here for example}  end;Before your (unique) instance finished you have to free the global atom with this line:- GlobalDeleteAtom(GlobalFindAtom('MyProgramsUniqueAtom'));This clears the atom, so you can now rerun your application.
0
 
LVL 1

Expert Comment

by:Gabor
ID: 1338149
Sorry Evil, but my CR-s disappeard. I don't know why.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Suggested Courses
Course of the Month13 days, 17 hours left to enroll

801 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