截取屏幕画面保存到 Abmp 中。function CaptureScreen4(Abmp: TBitmap): Boolean;
var
bmp: TBitmap;
adc: HDC;
begin
Result := False;
adc := GetDC(0);
if adc <> 0 then
try
bmp := TBitmap.Create();
bmp.Width := Screen.Width;
bmp.Height := Screen.Height;
Result := BitBlt(bmp.Canvas.Handle, 0, 0, bmp.Width, bmp.Height,
adc, 0, 0, SRCCOPY);
if Result then
begin
Abmp.Width := bmp.Width;
Abmp.Height := bmp.Height;
Abmp.Canvas.Draw(0, 0, bmp);
end;
finally
bmp.Free();
ReleaseDC(0, adc);
end;
end;大概每秒钟两次,运行2、3小时后,出错 Out of resources,怀疑是TBitmap类型造成的Device context句柄泄漏
var
bmp: TBitmap;
adc: HDC;
begin
Result := False;
adc := GetDC(0);
if adc <> 0 then
try
bmp := TBitmap.Create();
bmp.Width := Screen.Width;
bmp.Height := Screen.Height;
Result := BitBlt(bmp.Canvas.Handle, 0, 0, bmp.Width, bmp.Height,
adc, 0, 0, SRCCOPY);
if Result then
begin
Abmp.Width := bmp.Width;
Abmp.Height := bmp.Height;
Abmp.Canvas.Draw(0, 0, bmp);
end;
finally
bmp.Free();
ReleaseDC(0, adc);
end;
end;大概每秒钟两次,运行2、3小时后,出错 Out of resources,怀疑是TBitmap类型造成的Device context句柄泄漏
解决方案 »
- 一个打开子窗体的代码,请帮忙找找错误原因
- BORLAND C++中如何支持对.asm文件的编译??
- 在Delphi2006即将发布之际,大家来灌灌水,我先来谈点对未来Delphi发展的希望(散分)
- 要找工作了,在厦门,不知道做vc好还是Delphi好,郁闷
- 谁有 InstallShield Professional6.3的电子档的教程?不会用啊,急啊
- 有没有这样的控件,立即揭帖〉〉〉
- 从字符串中读取信息!
- 画圆的方向
- 要实现这种功能,代码怎么写?
- 怎样把一个由PARADOX建立的表的内容变成TEXT文件,由EMAIL传送
- delphi 中用DBgrid显示记录,怎么样能事项点击字段名就按照该字段排序的功能?
- 请问怎么用spcomm正确设置串口设备通讯地址,接收发送数据
你修改一下你的代码看看到底是出了什么错 if Result then
begin
Abmp.Width := bmp.Width;
Abmp.Height := bmp.Height;
Abmp.Canvas.Draw(0, 0, bmp);
end else SysErrorMessage(GetLasterror);不就知道是不是这里出问题了吗!