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

x
?
Solved

Instances in Delphi 2

Posted on 1997-07-03
2
Medium Priority
?
202 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

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

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

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…
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
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