unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, ComCtrls, StdCtrls,jpeg, ExtCtrls;type TForm1 = class(TForm) Button1: TButton; Memo1: TMemo; RichEdit1: TRichEdit; Timer1: TTimer; procedure Button1Click(Sender: TObject); procedure Timer1Timer(Sender: TObject); private { Private declarations } public { Public declarations } end;var Form1: TForm1; function PrintWindow(hwnd:HWND;hdcBlt:HWND;nFlags:word ):boolean;stdcall;external 'user32.dll';implementation{$R *.dfm}procedure PrintBakWnd(H:THandle); //H为要抓拍的窗口的句柄var DC:HDC; H1:HBITMAP; DC1:HDC; ScreenMap:TBitmap; R:TRect;begin DC:=GetWindowDC(H); GetWindowRect(H,R); H1:=CreateCompatibleBitmap(DC,r.Right-r.Left,r.Bottom-r.Top); DC1:=CreateCompatibleDC(DC); SelectObject(DC1,H1); PrintWindow(H,DC1,0); ScreenMap:=TBitmap.Create; ScreenMap.Handle:=H1; ScreenMap.SaveToFile('D:/[ON]liugaohui/后台保存3/'+FormatDateTime('YYYYMMDD-HHMMSS',Now)+'.bmp'); ScreenMap.Free; DeleteDC(DC); DeleteDC(DC1);end;procedure TForm1.Timer1Timer(Sender: TObject);varlgh:THandle;beginlgh:=form1.Handle; PrintBakWnd(lgh);end;最小化时是黑屏,挡住时可以用?是不是声明有问题?谢谢