Delphi Active Window Screenshot
问题 I am trying to add capture screenshot of active window using this code 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 := GetForegroundWindow; dc := GetDC(hWin) ; w := GetDeviceCaps (DC, HORZRES) ; h := GetDeviceCaps (DC, VERTRES) ; end; try