Como Saber se um Programa está sendo executado ?

Delphi

15/01/2004

Ola Galera...

Já vi este tópico no Fórum, mas não consigo encontrá-lo.
Preciso executar um programa que fiz, mas se um outro programa não estiver sendo executado.

Se alguém puder me ajudar eu agradeço!!!


Info.wtomfs

Info.wtomfs

Curtidas 0

Respostas

Michel

Michel

15/01/2004

var
Handle: THandle;
begin
Handle := FindWindow(´TFrmPrincipal´, nil);
if Handle <> 0 then { Já está aberto }
begin
Application.MessageBox( ´O Programa já está aberto em outra Instância !´,´Petrosoft´,MB_ICONINFORMATION + MB_OK );
// Exit;
end;

Application.Initialize;
Application.Title := ´PETROSOFT´;
Application.CreateForm(TfrmPrincipal, frmPrincipal);
Application.CreateForm(Tdados, dados);
Application.Run;
END.


GOSTEI 0
POSTAR