Código
//Inclua ShellApi na clausula uses do form onde for colocar esta
função
function ExecutarEEsperar(NomeArquivo : String) : Boolean;
var Sh: TShellExecuteInfo;
CodigoSaida: DWORD;
begin
FillChar(Sh, SizeOf(Sh), 0) ;
Sh.cbSize := SizeOf(TShellExecuteInfo) ;
with Sh do
begin
fMask := SEE_MASK_NOCLOSEPROCESS;
Wnd := Application.Handle;
lpVerb := nil;
lpFile := PChar(NomeArquivo);
nShow := SW_SHOWNORMAL;
end;
if ShellExecuteEx(@Sh) then
begin
repeat
Application.ProcessMessages;
GetExitCodeProcess(Sh.hProcess, CodigoSaida) ;
until not(CodigoSaida = STILL_ACTIVE);
Result := True;
end
else
Result := False;
end;
{
Dheyson Wildny Cruz Souza
dheysonws@gmail.com
}
Planeta Delphi - www.planetadelphi.com.br - Todos os direitos reservados | Copyright 2001-2009