Make the program to run an instance

zhaozj2021-02-16  60

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);

...

转载请注明原文地址:https://www.9cbs.com/read-21296.html

New Post(0)