Members

Technology Zones

IBM Learning Center

Articles

Hosted By

MaximumASP

Info

Rated
Read 29,020 times

Contents

Downloads

Related Categories

Avoiding Multiple Instances of an Application - Introduction

flounder

Introduction

For a variety of reasons it is often desirable to limit the number of running instances of a program to exactly one on a particular computer. There is a lot of folklore around about how to do this, and much of it is wrong. There are a few good methods, and a lot of flawed ones. 

I know. I used a flawed one for years. I even put the technique in our book, "Win32 Programming". I feel suitably embarrassed.

This essay examines some of the many solutions, and points out the problems in those that will fail, and the conditions under which they fail.

What is really dangerous is that Microsoft not only does not document the correct method, but offers two code examples of a fatally-flawed solution, which I discuss in detail.

Comments

  • Possible problem

    Posted by harpreetBamrah on 13 Jul 2005

    I am making a single instance appilcation and have followed all your suggestions . And i am really thankful to you for writing such an informative article.But i have a problem. It is my requirement th...

  • Great work

    Posted by vivek.kumbhojkar on 17 May 2004

    The article is realy good Even other tips and artcles by Joseph M. Newcomer are excellent for those who want to master vc++

  • cookbook version, single instance

    Posted by malyj on 01 Dec 2003

    Brilliant article!! Here it is again, boiled down to cookbook code for your MyApp.cpp file.
    Many thanks to Joseph Newcomer & Daniel Lohmann. // Mark Malyj

    //Avoiding Multiple Instances of an Appli...

  • Very Useful

    Posted by Randalism on 19 Apr 2002

    I found this information useful for an implementation that did not involve "Avoiding Multiple Instances of an Application," but did involve use of an EnumWindows() callback loop which was freezing up ...