delphi截屏
unit Unit1;interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
btn1: TButton;
procedure btn1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
function PrintWindow(SourceWindow: hwnd; Destination: hdc; nFlags: cardinal): bool; stdcall; external 'user32.dll' name 'PrintWindow';
implementation
{$R *.dfm}
procedure TForm1.btn1Click(Sender: TObject);
var
bmp : TBitmap;
wnd : Integer;
rec : TRect;
begin
wnd := FindWindow(nil, 'QQ2010');
GetWindowRect(wnd, rec);
bmp := TBitmap.Create;
try
bmp.Width := rec.Right - rec.Left;
bmp.Height := rec.Bottom - rec.Top;
bmp.PixelFormat := pf24bit;
PrintWindow(wnd, bmp.Canvas.Handle, 0);
bmp.SaveToFile('qq.jpg');
finally
bmp.Free;
CloseHandle(wnd);
end;
end;
end. 没看懂!! Delphi一直看不懂。。。
等我把vb学会了再学吧 想学 有点太深奥了
页:
[1]