Click here to Skip to main content
Licence 
First Posted 17 Apr 2002
Views 80,029
Bookmarked 23 times

Single Instance Checker

By | 17 Apr 2002 | Article
Only 1 instance of your application can run in the same time

Introduction

If you want your application have just only instance is run in the same time, you only download and use it.

Step 1: Add file "LimitSingleInstance.h" to your project. This file is written by Microsoft. :-)

Step 2: Run UUIDGEN.EXE to get ID. This tool is written by Micorosft :-)

Step 3: Declare a variable

CLimitSingleInstance g_SingleInstanceObj(TEXT("{ID get from UUIDGEN}"));

for ex: CLimitSingleInstance g_SingleInstanceObj(TEXT("{addb6c1d-d98d-40f4-8041-0eb6b8bc884c}"));

Step 4: InitInstance()

Only add this line to check instance and make sure only 1 instance can run.

if (g_SingleInstanceObj.IsAnotherInstanceRunning()) return FALSE;

VERY and VERY SIMPLE.

I get this information and "LimitSingleInstance.h" from KnowledgeBase of Mirosoft site.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

About the Author

bigZidane

Web Developer

Vietnam Vietnam

Member

// -------------------------------- //
// Personal Information //
// -------------------------------- //
Yahoo ID : dothanhtrongnghia
AOL : trongnghia95
ICQ : 151917542
Cell Phone : (84)-(90)-(3329867)

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board. (secure sign-in)
 
Search this forum  
 FAQ
    Noise  Layout  Per page   
  Refresh
GeneralMy vote of 1 Pinmembermercede23:20 15 Oct '09  
GeneralWhatta bunch PinmemberGoddFadda18:04 3 Jan '03  
GeneralWhatever PinsussAnonymous23:51 5 Sep '02  
Generalwinxp, multiple user PinmemberAnonymous9:21 19 Apr '02  
GeneralRe: winxp, multiple user PinsubeditorMichael Dunn11:59 19 Apr '02  
GeneralRe: winxp, multiple user PinmemberbigZidane17:21 19 Apr '02  
GeneralWhat's the point with UUIDGEN.EXE PinmemberErnest Laurentin4:44 18 Apr '02  
GeneralRe: What's the point with UUIDGEN.EXE PinmemberAnonymous23:35 18 Apr '02  
GeneralRe: What's the point with UUIDGEN.EXE Pinsussthenickname11:13 10 Apr '05  
GeneralBug PinmemberTim Smith4:23 18 Apr '02  
GeneralRe: Bug PinmemberAnonymous5:55 18 Apr '02  
GeneralHm... PinmemberGeorge22:28 17 Apr '02  
GeneralRe: Hm... PinmemberbigZidane22:43 17 Apr '02  
GeneralRe: Hm... PinmemberGeorge22:52 17 Apr '02  
GeneralRe: Hm... PinmemberbigZidane22:58 17 Apr '02  
GeneralRe: Hm... PinmemberJim A. Johnson4:17 18 Apr '02  
GeneralRe: Hm... PinmemberAnonymous5:58 18 Apr '02  
GeneralRe: Hm... Pinmembervenkpai12:47 20 Oct '05  
GeneralRe: Hm... Pinmembermercede23:21 15 Oct '09  

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Mobile
Web02 | 2.5.120517.1 | Last Updated 18 Apr 2002
Article Copyright 2002 by bigZidane
Everything else Copyright © CodeProject, 1999-2012
Terms of Use
Layout: fixed | fluid