![]() |
WinExec32AndWait nicht einbaubar...
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; |
Re: WinExec32AndWait nicht einbaubar...
Lol ... Ich musste es einfach umdrehen in:
Delphi-Quellcode:
... Programm startet aber immer noch nicht... :wall:
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; |
Re: WinExec32AndWait nicht einbaubar...
Problem gelöst ...
![]() |
Alle Zeitangaben in WEZ +1. Es ist jetzt 23:40 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz