CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Guest

    How to tell if your program is already running

    I've been wondering how you can make an application know if there is already another running instance. The reason is that I don't want the user opening this program more than once at a time. Does anybody know how to do this? Thanks for the help.


  2. #2
    Join Date
    Aug 1999
    Posts
    586

    Re: How to tell if your program is already running

    There are a number of ways. Perhaps the most common is to set up a named semaphore which you can check at program startup. If the semaphore is not already in use, then your program is not running so set it and then let your program start as usual. Next time someone starts your app, the semaphore will now be set when you test it. See "CMutex" and its cousins for details.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured