Skip to main content
gamedev.net
🔒 Locked

IDirectDrawSurface7::Lock Question

Started by darkchrono4 1 reply 700+ views
Original Post
darkchrono4
darkchrono4
I'm going through the Tricks of the Windows Game Programming Gurus and I got a question about Lock() on DirectDraw. These programs seem to be working but if I actually use the FAILED macro and show a dialog box I always get an error message. Will Lock() just not get the surface everytime? Or is something else screwy going on?
Supernat02
Supernat02
Are you talking about Direct Draw? You probably just need to pass in DDLOCK_WAIT so that it will return when a lock is achieved. It won't get a lock everytime, because sometimes a blit operation is in progress. You could also pass in DDLOCK_DONOTWAIT and do a while loop (while(FAILED(...)); though I don't recommend it.

Chris
Chris ByersMicrosoft DirectX MVP - 2005
darkchrono4
darkchrono4
lpddsprimary->Lock(NULL, &ddsd, DDLOCK_SURFACEMEMORYPTR | DDLOCK_WAIT, NULL);

Thats the line of code that I'm using. Everything seems to work right, can plot pixels, bitmaps, etc. I was just wondering why it would fail if its supposed to wait for the RAM to be free.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.