Einzelnen Beitrag anzeigen

venice2
(Gast)

n/a Beiträge
 
#12

AW: CreateProcess wirft Kernelbase Error

  Alt 3. Apr 2021, 14:11
Hier noch eine kleine Animation damit man überhaupt etwas sieht das sich was tut.
Function einfach ersetzen.

Delphi-Quellcode:
Function ReadPipe(StdIo: TStdIO): AnsiString;
var
  bAvailable: DWORD;
  Buffer: PAnsiChar;
begin
  if StdIo.stdOut.hRead <> INVALID_HANDLE_VALUE then
  begin
    bAvailable := 0;
    // First, check the size of the current pipe buffer
    PeekNamedPipe(StdIo.stdOut.hRead, nil, 0, nil, @bAvailable, nil);
    // if there is data waiting, fetch it
    if bAvailable > 0 then
    begin
      // set the new length of the result and initialize it
      Buffer := PAnsiChar(StrAlloc(bAvailable + 1));
      try
        ZeroMemory(Buffer, bAvailable + 1);
        // Read all data from the pipe
        ReadFile(StdIo.stdOut.hRead, Buffer^, bAvailable, bAvailable, nil);
        SetLength(result, bAvailable);
        CopyMemory(PAnsiChar(result), Buffer, bAvailable);
      finally
        StrDispose(Buffer);
      end;
    end
    else
    begin
      result := result + '.'; // <<<<<<<< Animation
      sleep(200);
      if length(Result) > 63 then
        Result := '';
    end;
  end
  else
    result := '';
end;
Ok gut mit den Spielereien war nur ein Test Projekt für meinen Video Player.
Eine perfekte Fortschrittanzeige läßt sich leider nicht realisieren.
  Mit Zitat antworten Zitat