Based on this article:
I use this code to make some animation on a given Window Handle while doing some job on my database:
while not Terminated do
begin
// some code....
// draw onto the Window DC
DC := GetDC(FWnd); // FWnd is the Window Handle
// DC := GetDCEx(FWnd, 0, DCX_VALIDATE or DCX_LOCKWINDOWUPDATE);
if DC <> 0 then
try
BitBlt(DC,
FPaintRect.Left,
FPaintRect.Top,
ImageRect.Right,
ImageRect.Bottom,
Bitmap.Canvas.handle,
0, 0,
SRCCOPY);
finally
ReleaseDC(FWnd, DC);
end;
// more code....
end; // end while
Is it thread safe, or should I somehow Lock the DC?
Also, Can I use the GetDCEx? Thanks.