Jump to content
  • Advertisement
Sign in to follow this  

Screenshot doesnt work always from a DirectDraw game

This topic is 2539 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!