Solved

Instances in Delphi 2

Posted on 1997-07-03
2
194 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
  • 2
2 Comments
 
LVL 1

Accepted Solution

by:
Gabor earned 50 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

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Intraweb submit form as a POST request 4 304
Reconfigure Delphi Install? 2 51
how can i search if string exist in array ? 3 59
Delphi: making a BW image transparent 10 40
This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …

810 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