12.10.2008, 01:37
|
Активный
|
|
Регистрация: 12.06.2008
Сообщения: 313
Репутация: 40
|
|
Код:
program Program1;
uses
Forms,
Windows,
Unit1 in 'Unit1.pas' {frmClient};
{$R *.res}
var
MutexHandle : THandle;
const
MutexName = 'one_inst_demo_mutex';
begin
MutexHandle := OpenMutex(MUTEX_ALL_ACCESS, false, MutexName);
if MutexHandle <> 0 then
begin
// запуск второй версии
end
else
begin
// запуск первой версии
MutexHandle := CreateMutex(nil, false, MutexName);
end;
Application.Initialize;
Application.CreateForm(TfrmClient, frmClient);
Application.Run;
CloseHandle(MutexHandle);
end.
|