Naughter Software Logo

CInstanceChecker v1.25 A C++ class to implement single instance apps

Welcome to CInstanceChecker, a C++ class to make your app into a single instance. Limiting your app to single instance is more tricky in Win32 with the removal of the hPrevInstance parameter from WinMain and the introduction of separate address spaces.

There are numerous examples already out there of making your app single instance, but some published code on the Internet require knowledge of undocumented or heavy duty MFC.

Other methods such as using FindWindow, FindWindowEx are not 100% bullet proof due to the pre-emptive Win32 environment.


This class internally uses a memory mapped file (MMF) into which the handle of the main window of your application is stuffed. When a second instance of your app is run, it detects that the memory mapped file exists, gets the window handle of the first instance from the MMF and reactivates the old window.


The enclosed zip file contains the CInstanceChecker source code and a simple MFC framewnd based app as well as a MFC dialog based app which demonstrates all the functionality of the class. For further details on how to use the class have a look at the BOOL CMyApp::InitInstance() function and the included documentation.





v1.25 (9 March 2022)

v1.24 (17 March 2020)

v1.23 (21 September 2019)

v1.22 (2 June 2019)

v1.21 (9 September 2018)

v1.20 (15 July 2018)

v1.19 (30 October 2017)

v1.18 (4 March 2016)

v1.17 (2 February 2008)

v1.16 (17 March 2007)

v1.15 (7 July 2006)

v1.14 (30 May 2005)

v1.13 (9 May 2004)

v1.12 (6 February 2003)

v1.11 (30 October 2002)

1 May 2002

v1.10 (23 March 2002)

v1.09 (31 August 2001)

v1.08 (21 July 2001)

v1.07 (17 June 2001)

v1.06 (11 January 2001)

v1.05 (1 January 2001)

v1.04 (17 May 2000)

v1.03 (15 May 2000)

v1.02 (28 March 2000)

v1.01 (27 March 2000)

v1.0 (29 July 1998)