Sign in to follow this  

DirectDraw blitting the primary surface

Recommended Posts

Hi im trying to create a function which returns a direct draw surface containing a copy of the primary surface. Heres my code: LPDIRECTDRAWSURFACE screenGrab(){ LPDIRECTDRAWSURFACE returnSurface; if(!(returnSurface = ddcreatesurface(windowwidth,windowheight,DDSCAPS_SYSTEMMEMORY))) {MessageBox(NULL,"Failed to create the dd surface","Error",MB_OK);} RECT rect; = 0; rect.bottom = windowheight-1; rect.left = 0; rect.right = windowwidth-1; if(FAILED(returnSurface->Blt(&rect, lpddsprimary, &rect, (DDBLT_WAIT | DDBLT_KEYSRC), NULL))) MessageBox(NULL, "Failed to copy the primary surface", "ERRO", MB_OK); return returnSurface; } When i call this function i get the message "failed to copy the primary surface. I also get that error message when i try to copy the secondary surface but it works fine when i try to copy another surface in the system memory. Am i doing something wrong or is it not possible to copy the primary surface? I really dont see why it wouldent be possible. Could it be happening because the primary surface is in the graphics card memory and the new surface is in the system memory?

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