Hey all, I've been working on a little side project while I figure things out for my PGD entry. Now though, I'm at a problem. I'm working in Lazarus (windows only) and need to get the raw screen pixel information into a buffer.

Typically in Delphi this is easy. Create a bitmap, size it, Call BitBlt on its HDC, and then copy the scanline[0] into your working array. In lazarus of course we don't have scanline property .

I thought that just simply creating the memory block and calling BitBlt passing the block might work, but no go. Code is below (doesn't work)

[pascal]
function ScreenCapRectPtr(R: TRect) : pointer;
var
sdc : HDC;
begin
result := GetMem((R.Right - R.Left)*(R.Bottom- R.Top));
sdc := GetDC(0);
try
BitBlt(HDC(result), 0, 0, (R.Right - R.Left), (R.Bottom- R.Top), sdc, R.Left, R.Top, SRCCOPY);
finally
ReleaseDC(0, sdc);
end;
end;
[/pascal]

Anyone know where to find info on WHAT exactly an HDC really is, or have code that works in Lazarus that achieves the desired result?

Thanks,
- Jeremy