Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Object-Pascal / Delphi-Language (https://www.delphipraxis.net/32-object-pascal-delphi-language/)
-   -   Delphi ShellExecuteEx Fehler (https://www.delphipraxis.net/125198-shellexecuteex-fehler.html)

Gehstock 2. Dez 2008 09:39


ShellExecuteEx Fehler
 
Programmende abwarten
das versuche ich mit dem hier gefundenen Code das Problem ist das er bei mir zwar schonmal funtioniert hat aber im jetzigen Fall einfach zu zeitig das Programmende meldet

Delphi-Quellcode:
function TForm1.Execute(FName :String): Boolean;
var
  SHELLINFO       : TShellExecuteInfo;
  lpExitCode      : Cardinal;
begin
 Result := False;
   fillChar(SHELLINFO, SizeOf(SHELLINFO), #0);
  with SHELLINFO do
  begin
    cbSize := SizeOf(SHELLINFO);
    fMask := 64;
    Wnd := 0;
    lpVerb      := nil;
    lpFile      := PChar('engine.exe ');
    lpParameters := PChar('Temp.flv' + ' -o "'+FName+'"'+' -oac mp3lame -ovc x264');
    lpDirectory := PChar(ExtractFilePath(Application.Exename));
    nShow := SW_HIDE;
  end;
  try
    ShellExecuteEx(@SHELLINFO);
   if WaitForSingleObject(SHELLINFO.hProcess, 1000) = 0 then
    repeat
      Application.ProcessMessages;
      GetExitCodeProcess(SHELLINFO.hProcess, lpExitCode);
    until (lpExitCode <> STILL_ACTIVE);
    Result := True;
  except
    on E:Exception do
    showmessage(e.Message);
  end;
   end;
es handelt sich um ein Konsolenprogramm das das Videoformat umwandelt

Edit: hab das Problem mit "IsFileinUse" umgangen


Alle Zeitangaben in WEZ +1. Es ist jetzt 12:29 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz