Einzelnen Beitrag anzeigen

Klaus01

Registriert seit: 30. Nov 2005
Ort: München
5.771 Beiträge
 
Delphi 10.4 Sydney
 
#3

AW: Speicherauslastung senken

  Alt 17. Nov 2010, 08:50
Delphi-Quellcode:
procedure Warten(x,y,Farbe: integer);
  var C: TCanvas;
      Count, Pixel: integer;
begin
  Count := 0;
  c := TCanvas.Create;
  try
    repeat
      C.Handle := GetWindowDC(GetDesktopWindow);
      Pixel := GetPixel(C.Handle,x,y);
      inc(Count);
      ReleaseDC(c.Handle);
    until (Pixel = Farbe) or (Count = 1000);
  finally
    C.Free;
  end;
end;
Begründung:
Zitat:
The application must call the ReleaseDC function for each call to the GetWindowDC function and for each call to the GetDC function that retrieves a common DC.

An application cannot use the ReleaseDC function to release a DC that was created by calling the CreateDC function; instead, it must use the DeleteDC function. ReleaseDC must be called from the same thread that called GetDC.
Grüße
Klaus
Klaus
  Mit Zitat antworten Zitat