반응형 중복실행방지2 [개발/MFC] 중복실행 방지하기 [개발/MFC] 중복실행 방지하기 TCHAR szAppName[] = _T("sbrich"); HANDLE hMutex = NULL; bool IsSecondInstance() { bool isSecondInstance= false; hMutex= CreateMutex(NULL, NULL, szAppName); int iLastError = GetLastError(); if(hMutex && (ERROR_ACCESS_DENIED == iLastError || ERROR_ALREADY_EXISTS == iLastError)) { ReleaseMutex(hMutex); hMutex= NULL; isSecondInstance= true; } return isSecondInstance; } int main() .. 2011. 9. 20. [개발/delphi] 중복 실행 방지 델파이로 중복 실행 방지 구현 소스 골라서 쓰자. =============================================================== #1 program Project; uses Forms, Windows, Dialogs, uMain in 'uMain.pas' {frmMain}; var hMutex : THandle; {$R *.res} begin hMutex := CreateMutex(nil, true, 'MajorProj'); // your mutex If (hMutex 0) and (GetLastError = 0) Then Begin Application.Initialize; Application.MainFormOnTaskbar := true; Application.C.. 2011. 9. 1. 이전 1 다음 반응형