Assuming I would like to program a magnifier, how could I capture the content of the screen excluding my very own window ? I know how to capture the screen with my own windo
You need to capture the screenshot from the DC of the desktop, into a bitmap in memory.
procedure CaptureScreenShot(acapture: TBitMap);
var c: TCanvas;
r: TRect;
begin
c:= TCanvas.Create;
c.Handle:= GetWindowDC (GetDesktopWindow);
try
r:= Rect(0,0,screen.width,screen.height);
acapture.Width:=screen.Width;
acapture.Height:=screen.Height;
acapture.Canvas.CopyRect(r, c, r);
finally
ReleaseDC(0, c.handle);
c.Free;
end;
end;
Add to this Uwe's answer to make your form invisible and you have....
FCapturedScreenShot:TBitmap;
....
FCapturedScreenShot:=TBitmap.Create;
....
AlphaBlend:=true;
AlphaBlendValue:=0;
CaptureScreenshot(FCapturedScreenShot);
AlphaBlendValue:=False;
use the captured screenshot for whatever you need, you might assign it over a bitmap in another form, or save it in an array of captured screens...