Attempting to lock surface closes program
I''ve been looking at this for a long time and can''t figure it out. I''m attempting to lock the surface, using the surfaceObject->Lock() method. I use the following code to lock the surface:
primarySurface->Lock(NULL, &surfaceDescription, DDLOCK_SURFACEMEMORYPTR | DDLOCK_WAIT, NULL);
Unfortunately, when this line is executed, my program automatically closes. I''m sure this is the problem, because when I comment it out, the black screen comes up as it should and stays there. I tried doing the DDraw error check (if(FAILED()) but it the lock did not appear to fail.
I''ll post more code if necessary, but does anyone know what the problem is from this explanation?
Peon
How have you initialized the surface desc? You need to zero it out and fill in its dwSize as well. If you don''t then things may go pear-shaped. As an aside, you should really think about using the back surface instead of the primary surface if at all possible (though that may not be relevant in this case).
If it''s not the surface desc then post a little more code surrounding that line.
If it''s not the surface desc then post a little more code surrounding that line.
Thanks for the help As it turns out, the problem wasn''t Lock() at all like I thought. I accidentally had CreateSurface() trapped in a loop and I was getting a PRIMARYSURFACEALREADYCREATED (something like that) error, which I guess was preventing the locking. Boy do I feel stupid
Peon
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement