반응형
뮤텍스(Mutex)로 프로그램 중복 실행 방지...
프로젝트 dpr 안에 프로그램 중복 실행 방지 코드 입력으로 간단히 처리

소스
program Project2; uses Forms, Windows, Unit1 in 'Unit1.pas' {Form1}; {$R *.res} Var Mutex: THandle; begin Mutex := CreateMutex(nil, True, '중복실행 방지'); if (Mutex > 0) and (GetLastError = 0) then begin try Application.Initialize; Application.Title := '중복실행 방지'; Application.MainFormOnTaskbar := True; Application.CreateForm(TForm1, Form1); Application.Run; except Application.Terminate; end; if Mutex > 0 then CloseHandle(Mutex); end; end.
마무리
Delphi7 또는 XE10.3 에서도 정상 작동 됩니다.
반응형
'Developers > Delphi[델파이]' 카테고리의 다른 글
[Delphi] DelphiSpeedUp 3.1 IDE AddIn (0) | 2019.09.24 |
---|---|
[Delphi] 100원 이하 절사 방법 - tip (0) | 2019.09.23 |
[Delphi] TIdHTTP 통해 https 통신 (85) | 2019.09.19 |