AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Thema durchsuchen
Ansicht
Themen-Optionen

WinExec32AndWait nicht einbaubar...

Ein Thema von DRPEnc · begonnen am 22. Feb 2004 · letzter Beitrag vom 22. Feb 2004
Antwort Antwort
DRPEnc

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

WinExec32AndWait nicht einbaubar...

  Alt 22. Feb 2004, 19:41
Ich will ein Programm durch mein Programm starten. Mit ShellExecute gehts nicht. Nun wollte ich die Funktion WinExec32AndWait ausprobieren und kann diese aber nicht einbauen. Hab ich was bei uses vergessen?

Delphi-Quellcode:
var
  Form6: TForm6;

implementation

uses D2V, AVAENC, ShellAPI;

{$R *.dfm}
Delphi-Quellcode:
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;
//ExecuteFile('', '', '', False);


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;
CU

DRPEnc
  Mit Zitat antworten Zitat
DRPEnc

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

Re: WinExec32AndWait nicht einbaubar...

  Alt 22. Feb 2004, 19:43
Lol ... Ich musste es einfach umdrehen in:



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;
... Programm startet aber immer noch nicht...
CU

DRPEnc
  Mit Zitat antworten Zitat
DRPEnc

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

Re: WinExec32AndWait nicht einbaubar...

  Alt 22. Feb 2004, 20:23
Problem gelöst ... http://www.delphipraxis.com/topic189...ht=exe+starten
CU

DRPEnc
  Mit Zitat antworten Zitat
Antwort Antwort


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 17:41 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