Solved

Instances in Delphi 2

Posted on 1997-07-03
2
186 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

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

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 tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

758 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

18 Experts available now in Live!

Get 1:1 Help Now