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; 用法示例: var b:TBitmap; begin b := TBitmap.Create; try ScreenShot(TRUE, b) ; Image1.Picture.Bitmap.Assign(b) ; finally b.FreeImage; FreeAndNil(b) ; end; 迅雷专用高速下载