G
gxcooo
Unregistered / Unconfirmed
GUEST, unregistred user!
我能抓到窗体内的图象,就是抓不到[red]标题栏和菜单[/red],但snagit能办到,何解?
ActiveWnd := GetForegroundWindow;
if ActiveWnd <> NULL then
begin
Form1.Image1.Picture.Bitmap := nil;
//Windows.GetWindowRect(ActiveWnd, Rect);//这个也不行
Windows.GetClientRect(ActiveWnd, Rect);//只能得到窗体内的图象,得不到标题栏
ScreenPic.Width := Rect.Right - Rect.Left;
ScreenPic.Height := Rect.Bottom - Rect.Top;
Image1.Width := Rect.Right - Rect.Left;
Image1.Height := Rect.Bottom - Rect.Top;
BitBlt(ScreenPic.Canvas.handle, 0, 0, ScreenPic.Width, ScreenPic.Height, GetDc(ActiveWnd), 0, 0, SRCCOPY);
Form1.Image1.Picture.Bitmap := ScreenPic;
end;
Form1.WindowState := wsNormal; //复原窗口状态
Form1.show; //显示窗口
ActiveWnd := GetForegroundWindow;
if ActiveWnd <> NULL then
begin
Form1.Image1.Picture.Bitmap := nil;
//Windows.GetWindowRect(ActiveWnd, Rect);//这个也不行
Windows.GetClientRect(ActiveWnd, Rect);//只能得到窗体内的图象,得不到标题栏
ScreenPic.Width := Rect.Right - Rect.Left;
ScreenPic.Height := Rect.Bottom - Rect.Top;
Image1.Width := Rect.Right - Rect.Left;
Image1.Height := Rect.Bottom - Rect.Top;
BitBlt(ScreenPic.Canvas.handle, 0, 0, ScreenPic.Width, ScreenPic.Height, GetDc(ActiveWnd), 0, 0, SRCCOPY);
Form1.Image1.Picture.Bitmap := ScreenPic;
end;
Form1.WindowState := wsNormal; //复原窗口状态
Form1.show; //显示窗口