CSingleInstance

An MFC class to implement single instance apps
Download

CSingleInstance Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Freeware
  • Publisher Name:
  • Naughter Software
  • Operating Systems:
  • Windows All
  • File Size:
  • 23 KB

CSingleInstance Tags


CSingleInstance Description

The CSingleInstance was designed to be an MFC 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.


CSingleInstance Related Software