Sign in to follow this  
prux

Screenshot doesnt work always from a DirectDraw game

Recommended Posts

prux    138
hey all,

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:

[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);
[/code]

I guess its some kind of synchronisation failing.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this