Einzelnen Beitrag anzeigen

DRPEnc

Registriert seit: 20. Feb 2004
Ort: Noch unterm Mond
126 Beiträge
 
#17

Re: ShellExecute startet das Programm nicht...

  Alt 22. Feb 2004, 20:12
Sorry, bin Anfänger ...

Damit gehts auch nicht:

Delphi-Quellcode:
function WinExec32AndWait(const Cmd: string; const CmdShow: Integer): Cardinal;
var
  sui : TStartupInfo;
  pi : TProcessInformation;
begin
  Result := Cardinal($FFFFFFFF);
  ZeroMemory(@sui,sizeof(TStartupInfo)); sui.cb := SizeOf(TStartupInfo);
                                         sui.dwFlags := STARTF_USESHOWWINDOW;
                                         sui.wShowWindow := CmdShow;

  if(CreateProcess(nil,pchar(Cmd),nil,nil,False,NORMAL_PRIORITY_CLASS,nil,nil,sui,pi)) then
    begin
      WaitForInputIdle(pi.hProcess, INFINITE);
      if(WaitForSingleObject(pi.hProcess, INFINITE) = WAIT_OBJECT_0) then
        begin
          {$IFDEF DELPHI3}
          if not GetExitCodeProcess(pi.hProcess, Integer(Result)) then
          {$ELSE}
          if not GetExitCodeProcess(pi.hProcess, Result) then
          {$ENDIF DELPHI3}
            Result := Cardinal($FFFFFFFF);
        end;
      CloseHandle(pi.hThread);
      CloseHandle(pi.hProcess);
    end;
end;

procedure TForm6.GroupBox3Click(Sender: TObject);
var ChildExitCode: Cardinal;
begin
  ChildExitCode := WinExec32AndWait('"C:\DRPEncFiles\DVD2AVIDRPEnc.exe"', SW_NORMAL);
  if ChildExitCode = $FFFFFFFF then
     ShowMessage('Delphi 6 konnte nicht gestartet werden.');
end;
CU

DRPEnc
  Mit Zitat antworten Zitat