朋友们,
需要对没有我的表格的所有桌面进行屏幕截图并加载到 TImage 中。
在 Windows XP、7 中成功 - 只需 ALPHABLEND = TRUE + SCREENSHOT PROCEDURE。
但相同的代码在 Windows 8 中不起作用 - 捕获所有屏幕,包括表单。
我知道问题与 AERO - DWM.EXE - 成功使用 pssuspend.exe (sysinternals) - 挂起 winlogon.exe 并杀死 dwm.exe 有关
有人可以告诉我如何在 Windows 8 中捕获所有桌面而不需要我的表单吗?
prntscr.com/314rix - WIN7 中的成功
prntscr.com/314tj7 - 在 WIN8 中失败
prntscr com/31502u - 在 WIN8 中暂停 WINLOGON.EXE 并杀死 DWM.EXE
www sendspace com/file/b5oxhb - 源代码
// FORM -> ALPHABLEND -> TRUE
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls,
Clipbrd;
type
TForm1 = class(TForm)
Button1: TButton;
Image1: TImage;
ScrollBox1: TScrollBox;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure ScreenShot(DestBitmap: TBitmap);
var
DC: HDC;
begin
DC:=GetDC(GetDesktopWindow);
try
DestBitmap.Width:=GetDeviceCaps(DC, HORZRES);
DestBitmap.Height:=GetDeviceCaps(DC, VERTRES);
BitBlt(DestBitmap.Canvas.Handle,0,0,DestBitmap.Width,DestBitmap.Height,DC,0,0,SRCCOPY);
finally
ReleaseDC(GetDesktopWindow, DC);
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
ScreenShot(Image1.Picture.Bitmap);
end;
end.