1. Home
  2. Computing & Technology
  3. Delphi Programming
Zarko Gajic
Zarko's Delphi Programming Blog

By Zarko Gajic, About.com Guide to Delphi Programming

Controlling the Number of Application Instances

Tuesday October 9, 2007
in Advanced Delphi :: In this article you'll learn how to "run-once" enable a Delphi application that can check for its previous (running) instance. Along the process, several techniques of implementing such a check will be discussed; as well as how to bring your already running application to the foreground, if a user tries to run it "one more time". By the end of the article you'll have a copy-to-go code to control the behavior of your application's multiple instances: with the option to limit the number of running instances.

Read the full article to learn how to Control the Number of Application Instances.

Related:

Comments
October 9, 2007 at 5:42 pm
(1) Adrian Morris says:

I am surprised no one ever considers the simple solution. I have been using it for years and you are welcome to the code. Basically, it consists of trying to delete a file that might be called Mult.txt. You then write it and open it, so that the next instance will fail to delete it as the operating system will not allow such an operation. This isn’t quite how it works as I wrote it 10 years ago and I suspect many other have done the same. I could write it up, if there is any interest.

October 9, 2007 at 8:21 pm
(2) Thaddy says:

This screams for a class helper for TApplication. Try it, much cleaner…

October 10, 2007 at 4:17 am
(3) Zarko Gajic says:

Adrian, we are always interested in different ways of solving something!

Thaddy, class helpers are available only to Delphi versions > 7 :(

Leave a Comment

Line and paragraph breaks are automatic. Some HTML allowed: <a href="" title="">, <b>, <i>, <strike>

Explore Delphi Programming
About.com Special Features

Reader's Choice Award Winners

What are the best instant messengers, apps, editors and more? You told us, for our 2010 technology awards program. More >

iPad Central

Is Apple's new tablet computer impractical, a must-have -- or both? We'll help you figure it out. More >

  1. Home
  2. Computing & Technology
  3. Delphi Programming

©2010 About.com, a part of The New York Times Company.

All rights reserved.