For Capture the Screen Shot of the Active Window, I use a source code Capture the Screen Shot of the Active Window with this code in Delphi:
procedure ScreenShot(activeWindow: bool; destBitmap : TBitmap) ;
var
w,h : integer;
DC : HDC;
hWin : Cardinal;
r : TRect;
begin
if activeWindow then
begin
hWin := GetForegroundWindow;
dc := GetWindowDC(hWin) ;
GetWindowRect(hWin,r) ;
w := r.Right - r.Left;
h := r.Bottom - r.Top;
end
else
begin
hWin := GetDesktopWindow;
dc := GetDC(hWin) ;
w := GetDeviceCaps (DC, HORZRES) ;
h := GetDeviceCaps (DC, VERTRES) ;
end;
try
destBitmap.Width := w;
destBitmap.Height := h;
BitBlt(destBitmap.Canvas.Handle,
0,
0,
destBitmap.Width,
destBitmap.Height,
DC,
0,
0,
SRCCOPY) ;
finally
ReleaseDC(hWin, DC) ;
end;
end;
Usage:
var
b:TBitmap;
begin
b := TBitmap.Create;
try
ScreenShot(TRUE, b) ;
Image1.Picture.Bitmap.Assign(b) ;
finally
b.FreeImage;
FreeAndNil(b) ;
end;
How can I convert that to take a screenshot of a Protected active software like Oxynger KeyShield?