The code originates from the work of Jeffry Richter "Windows Core Programming"
Write the following code in the initInstance () function:
// only run an example handle happ = createmutex (Null, False, "OnlyoneInstanceexample"); if (getLastError () == Error_Already_exists {AFXMESSAGEBOX ("Already EXIST An Instance!"); Return false;}
... // Other initialization code ...
CloseHandle (HAPP);
...