APP
중복 실행 방지
ezmind
2012. 10. 23. 20:09
program Project1; uses Forms, windows, Unit1 in 'Unit1.pas' {Form1}; {$R *.res} var FMutexHandle: THandle; FMutexErrCode: integer; begin FMutexHandle := CreateMutex(nil, TRUE, pchar('여기다 중복되지 않을 뮤텍스 이름을 지정한다') ); FMutexErrCode := GetLastError; if FMutexHandle <> 0 then begin if FMutexErrCode = ERROR_ALREADY_EXISTS then begin CloseHandle(FMutexHandle); exit; end; end; Application.Initialize; Application.CreateForm(TForm1, Form1); Application.Run; end; |