Archived

This topic is now archived and is closed to further replies.

LordReaper

DDraw Lock();

Recommended Posts

LordReaper    122
I''m experiencing a very strange problem here... I''m doing a alpha blending function to DDraw, but when I try to lock my surface, my app simply freezes. I''ve debugged it and I found the error was in the Lock command line. I''ve also zeroed the DDSURFACECAPS2 and put the dwSize to sizeof(ddscaps); below is the piece of code that is making my program freeze: ZeroMemory(&srcDesc, sizeof(srcDesc)); srcDesc.dwSize = sizeof(srcDesc); srcDDS->Lock(NULL, &srcDesc, DDLOCK_WAIT | DDLOCK_SURFACEMEMORYPTR, NULL); Any ideas why I get a crash??? Thanks! -LordAsm-

Share this post


Link to post
Share on other sites
Jason Zelos    211
If you use the DDLOCK_DONOTWAIT flag you can retrieve error codes, although I cannot see any problem with the code above. I''d guess your problem is where you actualy write to memory, have you tried just using lock then unlock without any memory access in between ?

Reference:
http://msdn.microsoft.com/archive/default.asp?url=/archive/en-us/ddraw7/directdraw7/ddref_57ef.asp

,Jay

Share this post


Link to post
Share on other sites
S1CA    1418
If it''s freezing when you single-step the code in the debugger, then add the NOSYSLOCK flag to the Lock().

If you don''t specify that flag, then the driver is free to essentially disable/shut down Windows for the duration of the lock. As you can probably guess, this also means your debugger/IDE is disabled too!...



--
Simon O''Connor
Creative Asylum Ltd
www.creative-asylum.com

Share this post


Link to post
Share on other sites