Thema: Delphi Ersatz für Sleep?

Einzelnen Beitrag anzeigen

PeterPanino

Registriert seit: 4. Sep 2004
1.451 Beiträge
 
Delphi 10.4 Sydney
 
#5

AW: Ersatz für Sleep?

  Alt 9. Mär 2016, 20:02
IsWindowVisible(FAppWnd) geht leider nicht, da es gleich True zurückgibt, ohne dass es fertig eingebettet ist:
Delphi-Quellcode:
if ShellExecuteEx(@SEInfo) then // wenn Programm erfolgreich gestartet wurde
  begin
    RetryCount := 0;
    repeat
      FAppWnd := FindWindow(PChar('HH Parent'), nil);
      Sleep(100);
      Inc(RetryCount);
    until (FAppWnd <> 0) or (RetryCount > 10);

    if FAppWnd <> 0 then // wenn das Fenster der ViewerApp gefunden wurde
    begin
      Winapi.Windows.SetParent(FAppWnd, SEInfo.Wnd);
      SetWindowLong(FAppWnd, GWL_STYLE, GetWindowLong(Handle, GWL_STYLE) and not WS_BORDER and not WS_THICKFRAME and
        not WS_DLGFRAME);

      SetWindowPos(FAppWnd, 0, 0, 0, APanel.Width, APanel.Height, SWP_ASYNCWINDOWPOS);

      Delay(1000);

      ShowWindow(FAppWnd, SW_SHOWMAXIMIZED);
    end;
  end;
  Mit Zitat antworten Zitat