Click here to Skip to main content
12,065,756 members (25,960 online)
Click here to Skip to main content
Add your own
alternative version

Stats

86.2K views
1.1K downloads
24 bookmarked
Posted

Single Instance Checker

, 17 Apr 2002
Rate this:
Please Sign up or sign in to vote.
Only 1 instance of your application can run in the same time
<!-- Download Links --> <!-- Add the rest of your HTML here -->

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. Smile | :)

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

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

Share

About the Author

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

You may also be interested in...

Comments and Discussions

 
QuestionThanks, bigZidane. Pin
TigerRex1-Nov-14 23:13
memberTigerRex1-Nov-14 23:13 
GeneralMy vote of 1 Pin
mercede16-Oct-09 0:20
membermercede16-Oct-09 0:20 
GeneralWhatta bunch Pin
GoddFadda3-Jan-03 19:04
memberGoddFadda3-Jan-03 19:04 
GeneralWhatever Pin
Anonymous6-Sep-02 0:51
sussAnonymous6-Sep-02 0:51 
Generalwinxp, multiple user Pin
Anonymous19-Apr-02 10:21
memberAnonymous19-Apr-02 10:21 
GeneralRe: winxp, multiple user Pin
Michael Dunn19-Apr-02 12:59
subeditorMichael Dunn19-Apr-02 12:59 
GeneralRe: winxp, multiple user Pin
bigZidane19-Apr-02 18:21
memberbigZidane19-Apr-02 18:21 
GeneralWhat's the point with UUIDGEN.EXE Pin
Ernest Laurentin18-Apr-02 5:44
memberErnest Laurentin18-Apr-02 5:44 
GeneralRe: What's the point with UUIDGEN.EXE Pin
Anonymous19-Apr-02 0:35
memberAnonymous19-Apr-02 0:35 
GeneralRe: What's the point with UUIDGEN.EXE Pin
thenickname10-Apr-05 12:13
sussthenickname10-Apr-05 12:13 
GeneralBug Pin
Tim Smith18-Apr-02 5:23
memberTim Smith18-Apr-02 5:23 
GeneralRe: Bug Pin
Anonymous18-Apr-02 6:55
memberAnonymous18-Apr-02 6:55 
GeneralHm... Pin
George17-Apr-02 23:28
memberGeorge17-Apr-02 23:28 
GeneralRe: Hm... Pin
bigZidane17-Apr-02 23:43
memberbigZidane17-Apr-02 23:43 
GeneralRe: Hm... Pin
George17-Apr-02 23:52
memberGeorge17-Apr-02 23:52 
GeneralRe: Hm... Pin
bigZidane17-Apr-02 23:58
memberbigZidane17-Apr-02 23:58 
GeneralRe: Hm... Pin
Jim A. Johnson18-Apr-02 5:17
memberJim A. Johnson18-Apr-02 5:17 
GeneralRe: Hm... Pin
Anonymous18-Apr-02 6:58
memberAnonymous18-Apr-02 6:58 
GeneralRe: Hm... Pin
venkpai20-Oct-05 13:47
membervenkpai20-Oct-05 13:47 
GeneralRe: Hm... Pin
mercede16-Oct-09 0:21
membermercede16-Oct-09 0:21 

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

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

| Advertise | Privacy | Terms of Use | Mobile
Web03 | 2.8.160207.1 | Last Updated 18 Apr 2002
Article Copyright 2002 by bigZidane
Everything else Copyright © CodeProject, 1999-2016
Layout: fixed | fluid