Announcement

Collapse
No announcement yet.

Aus (meiner) exe eine andere exe starten und warten..

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Aus (meiner) exe eine andere exe starten und warten..

    wie kann ich warten bis eine exe geschlossen wurde? (wird mit tapplication.free zerstört- also nicht freigeben)

    wie kann ich warten?

    BINE

  • #2
    oder anders

    ...warte bis ein feld in der Tabelle true wird..

    BINE :O

    Comment


    • #3
      ich brauche nur einen befehl für warten ..

      Comment


      • #4
        Hallo Bine,

        das folgende Bsp. startet Notepad und wartet dann bis Notepad beendet wird:

        <pre><code>
        procedure TForm1.Button1Click(Sender: TObject);
        var
        AStartUp: TStartUpInfo;
        AProcInfo: PROCESS_INFORMATION;
        begin
        FillChar(AStartUp, SizeOf(TStartUpInfo), 0);
        FillChar(AProcInfo, SizeOf(PROCESS_INFORMATION), 0);
        with AStartUp do
        begin
        cb := SizeOf(TStartUpInfo);
        dwFlags := STARTF_USESHOWWINDOW;
        wShowWindow := SW_SHOWNORMAL;
        end;
        CreateProcess('c:\windows\Notepad.exe', nil, nil, nil, True, NORMAL_PRIORITY_CLASS,
        nil, nil, AStartUp, AProcInfo);
        WaitForSingleObject(AProcInfo.hProcess, INFINITE);
        Application.MessageBox('Notepad beendet!', 'Starter', mb_OK);
        end;
        </pre></code>

        Gruß Fal
        Wenn du denkst du hast alle Bugs gefunden, dann ist das ein Bug in deiner Denksoftware.

        Quellcode ohne ein Mindestmaß an Formatierung sehe ich mir nicht an! Ich leiste keinen Privatsupport per Mail oder PN!

        Comment


        • #5
          Danke der Code funktioniert OHNE PROBLEME

          BINE :

          Comment


          • #6
            Aus der Jedi Code Library:<br>
            function WinExec32AndWait(const Cmd: string; const CmdShow: Integer): Cardinal;<br>
            var<br>
            StartupInfo: TStartupInfo;<br>
            ProcessInfo: TProcessInformation;<br>
            begin<br>
            Result := Cardinal($FFFFFFFF);<br>
            FillChar(StartupInfo, SizeOf(TStartupInfo), #0);<br>
            StartupInfo.cb := SizeOf(TStartupInfo);<br>
            StartupInfo.dwFlags := STARTF_USESHOWWINDOW;<br>
            StartupInfo.wShowWindow := CmdShow;<br>
            if CreateProcess(nil, PChar(Cmd), nil, nil, False, NORMAL_PRIORITY_CLASS,<br>
            nil, nil, StartupInfo, ProcessInfo) then<br>
            begin<br>
            WaitForInputIdle(ProcessInfo.hProcess, INFINITE);<br>
            if WaitForSingleObject(ProcessInfo.hProcess, INFINITE) = WAIT_OBJECT_0 then<br>
            begin<br>
            {$IFDEF DELPHI3}<br>
            if not GetExitCodeProcess(ProcessInfo.hProcess, Integer(Result)) then<br>
            {$ELSE}<br>
            if not GetExitCodeProcess(ProcessInfo.hProcess, Result) then<br>
            {$ENDIF DELPHI3}<br>
            Result := Cardinal($FFFFFFFF);<br>
            end;<br>
            CloseHandle(ProcessInfo.hThread);<br>
            CloseHandle(ProcessInfo.hProcess);<br>
            end;<br>
            end;<br&gt

            Comment

            Working...
            X