delphi 截取当前活动窗口?
控件:button点击button控件保存当前活动窗口到指定根目录文件夹内类似于“Alt”+“PrintScreen”...
控件:button点击button控件保存当前活动窗口到指定根目录文件夹内类似于“Alt”+“Print Screen”
展开
2013-09-18
展开全部
截屏为BMP文件
program GetScrnBmp;
uses
Windows, Graphics;
{$R *.RES}
var
B: TBitmap;
S: string;
begin
B := TBitmap.Create;
B.Width := GetSystemMetrics(SM_CXSCREEN); {Screen.Width}
B.Height := GetSystemMetrics(SM_CYSCREEN); {Screen.Height}
BitBlt(B.Canvas.handle, 0, 0, B.Width, B.Height, GetDc(0), 0, 0, SRCCOPY);
if ParamStr(1) <> '' then
S := ParamStr(1) + '.bmp'
else
S := 'Screen.bmp';
b.SaveToFile (s);
b.Free;
end.
program GetScrnBmp;
uses
Windows, Graphics;
{$R *.RES}
var
B: TBitmap;
S: string;
begin
B := TBitmap.Create;
B.Width := GetSystemMetrics(SM_CXSCREEN); {Screen.Width}
B.Height := GetSystemMetrics(SM_CYSCREEN); {Screen.Height}
BitBlt(B.Canvas.handle, 0, 0, B.Width, B.Height, GetDc(0), 0, 0, SRCCOPY);
if ParamStr(1) <> '' then
S := ParamStr(1) + '.bmp'
else
S := 'Screen.bmp';
b.SaveToFile (s);
b.Free;
end.
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询