[Lazarus] BitBlt caused SIGFPE in lclproc.pas

xrfang xrfang at gmail.com
Fri Mar 1 04:46:17 CET 2013


Hi There,

Why the following code generated SIGFPE on BitBlt?

=======================================
procedure TForm1.Button1Click(Sender: TObject);
var
  png: TPortableNetworkGraphic;
  ScreenDC, ClipDC: HDC;
  r: TRect;
begin
  r := Rect(0, 0, 300, 200);
  png := TPortableNetworkGraphic.Create;
  ScreenDC := GetDC(0);
  ClipDC := CreateCompatibleDC(ScreenDC);
  BitBlt(ClipDC, 0, 0, r.Right - r.Left, r.Bottom - r.Top, ScreenDC, r.Left, r.Top, SRCCOPY);
  png.LoadFromDevice(ClipDC);
  DeleteDC(ClipDC);
  ReleaseDC(0, ScreenDC);
  png.SaveToFile('test.png');
end;
=======================================

I am on Ubuntu GTK2 and hope this code to run cross platform.

Thanks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20130301/e7b8c51f/attachment-0002.html>


More information about the Lazarus mailing list