Posts Tagged ‘delphi 7 birden fazla uygulama açılmasın’
delphi mutex
Ağustos 20, 2010
Yorum bırakın
Programın birden fazla açılmasını engellemek veya kontrol altına almak için mutex komutu kullanılır.
program MutexApp; uses Forms, Windows, Unit1 in 'Unit1.pas' {Form1}; {$R *.res} var Mutex : THandle; begin Mutex := CreateMutex(nil, True, 'MutexApp.EXE'); if (Mutex = 0) OR (GetLastError = ERROR_ALREADY_EXISTS) then begin Application.MessageBox(' Program kullanımda !!! ','Hata',MB_OK+MB_ICONWARNING); end else begin Application.Initialize; Application.CreateForm(TForm1, Form1); Application.Run; if Mutex <> 0 then CloseHandle(Mutex); end; end.