Einzelnen Beitrag anzeigen

Benutzerbild von himitsu
himitsu

Registriert seit: 11. Okt 2003
Ort: Elbflorenz
43.168 Beiträge
 
Delphi 12 Athens
 
#28

AW: Probleme mit Bildschirmschonervorschau

  Alt 25. Mai 2012, 19:23
Die Schleife im Timer war schon unschön, aber nun auch noch Halt?

Wie währe es mit OnIdle?

Delphi-Quellcode:
begin
  if AnsiStartsText('/P',ParamStr(1)) then //if Copy(UpperCase(ParamStr(1)),1,2)='/P' then
    begin
      DemoWnd := StrToInt(ParamStr(2));
      while IsWindow(DemoWnd) and not IsWindowVisible(DemoWnd) do // war 'ne Endlosschleife, falls es das Fenster nicht mehr gibt, oder es nie sichtbar wird
        Sleep(50);
      GetWindowRect(DemoWnd,MyRect);
      ScrWidth:=succ(MyRect.Right-MyRect.Left);
      ScrHeight:=succ(MyRect.Bottom-MyRect.Top);
      MyRect:=Rect(0,0,ScrWidth-1,ScrHeight-1);
      MyCanvas := TCanvas.Create;
      try
        MyCanvas.Handle := GetDC(DemoWnd);
        while IsWindowVisible(DemoWnd) do
          MyCanvas.Pixels[random(ScrWidth),random(ScrHeight)]:=random($FFFFFF+1);
      finally
        MyCanvas.Free;
      end;
    end
  else
    begin
      Application.Initialize;
      Application.CreateForm(TScreen, Screen);
      Application.Run;
    end;
end.
Garbage Collector ... Delphianer erzeugen keinen Müll, also brauchen sie auch keinen Müllsucher.
my Delphi wish list : BugReports/FeatureRequests
  Mit Zitat antworten Zitat