How can I check the running processes in Windows with C++, so that I can avoid running my application again when I double click it several times. Thanks.
Here an example
===========================================================
WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
{
int Mutex;
Mutex= (int) CreateMutex(NULL,true,GetPrevInstMutexName()); // Check if an Instance of the Programm running
if((Mutex != NULL) && (GetLastError()==0)) //if not start Program
{
try
{
Application->Initialize();
.
.
-
Application->Run();
}
catch (Exception &exception)
{
Application->ShowException(&exception);
}
}
return 0;
==========================================================
This code has to be inserted into your file
Projectname.cpp
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.