Hago asi, usando Mutex de la Unit Windows
Cita:
Var
Mutex : THandle;
begin
Mutex := CreateMutex(nil, True, 'SAC_GERENCIAL');//'SAC_GERENCIAL este es el nombre de mi aplicacion.
if (Mutex <> 0) and (GetLastError = 0) then
begin
Application.Initialize;
Application.MainFormOnTaskbar := True;
Application.Title := 'Gerencial';
Application.CreateForm(TDM_Principal, DM_Principal);
Application.CreateForm(TDM_NFiscal, DM_NFiscal);
end
else
MessageDlg(' SAC_GERENCIAL' + #13 +
'Sistema já está em execução', mtInformation, [mbOK], 0);
|