BOOL CheckAlreadyRun(void) { HANDLE mutex; if (mutex = CreateMutex(NULL, FALSE, NOMMUTEX)) { if (GetLastError() == ERROR_ALREADY_EXISTS) { //Si on est ici c'est que le programme est déja lancé ReleaseMutex(mutex); return FALSE; } ReleaseMutex(mutex); } return TRUE; } // et cela on le met dans le winmain avant toute creatio de window... if( CheckAlreadyRun() && (existhwnd = FindWindow("Parent", "3D Voice Chat")) ) { // If minimize then maximize :) if( IsIconic(existhwnd) ) OpenIcon(existhwnd); // Bring window to top BringWindowToTop(existhwnd); return 0; }
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre question