im trying to create a screenshot program, it works good but with DirectDraw games, it often fails. A good result:
http://img12.imageshack.us/img12/1412/goodb.gif
and a bad:
http://img202.imageshack.us/img202/7563/badh.gif
there are missing part of this image. Sometimes only the background is seen without the landscape. The screenshot code:
dc := GetWindowDc(hWindow);
if (dc = 0) then Exit;
if lpPal = nil then
begin
GetMem(lpPal, SizeOf(TLOGPALETTE) + (255 * SizeOf(TPALETTEENTRY)));
FillChar(lpPal^, SizeOf(TLOGPALETTE) + (255 * SizeOf(TPALETTEENTRY)), #0);
lpPal^.palVersion := $300;
lpPal^.palNumEntries := GetSystemPaletteEntries(dc, 0,256, lpPal^.palPalEntry);
if (lpPal^.PalNumEntries <> 0) then
begin
bm.Palette := CreatePalette(lpPal^);
end;
end;
StretchBlt (bm.Canvas.Handle, 0,0, Bm.Width,Bm.Height, Dc, 0,0, Screen.Width,Screen.Height, SRCCOPY);
ReleaseDc (hWindow, dc);
I guess its some kind of synchronisation failing.