• Advertisement
Sign in to follow this  

IDirectDrawSurface7::Lock Question

This topic is 4797 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

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?

Share this post


Link to post
Share on other sites
Advertisement
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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement