Sign in to follow this  

Screenshot doesnt work always from a DirectDraw game

Recommended Posts

hey all,

im trying to create a screenshot program, it works good but with DirectDraw games, it often fails. A good result:

and a bad:

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
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
bm.Palette := CreatePalette(lpPal^);

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.

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