Jump to content
  • Advertisement
Sign in to follow this  

TestCooperativeLevel causing exception

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

Hi everyone,

 

I've got a problem when I try to debug my program using the VS2012 debugger. I've got the following issue when I try to run TestCooperativeLevel():

 

[attachment=14629:exception.jpg]

 

Note that soundState() simply changes the pause state of some sounds (using functions in the irrKlang library). Even if I remove the soundState() line, the same exception is thrown. The problem doesn't prevent my game from running on my Win7 laptop, but it causes an outright crash when I run it on my XP computer. Any ideas what could be causing the exception?

 

Thanks!

Share this post


Link to post
Share on other sites
Advertisement

Check if d3ddev is null. Your sound engine might be initiated before the graphics part.

Edited by Dawoodoz

Share this post


Link to post
Share on other sites

A WM_ACTIVATE or WM_ACTIVATEAPP message can be sent when your window is first created, which is probably what is happening here.

 

This, by the way, is one of the reasons why you should NEVER check for lost devices from WM_ACTIVATE or WM_ACTIVATEAPP (the other one is that there are conditions other than Alt-Tabbing which can cause a lost device; one example might be another program taking exclusive ownership of the display while you're running in a windowed mode).  Do it the documented way and check your HRESULT from Present instead.

Edited by mhagain

Share this post


Link to post
Share on other sites

OK, I changed it so that the lost device checking is done every frame instead, and yes, it now works fine. Thanks!

 

By the way mhagain, how do you mean check the HRESULT from Present? Does it return a specific result if there's a lost device?

Share this post


Link to post
Share on other sites

By the way mhagain, how do you mean check the HRESULT from Present? Does it return a specific result if there's a lost device?

 

For some weird reason this is not included in the MSDN documentation at http://msdn.microsoft.com/en-us/library/windows/desktop/bb174423%28v=vs.85%29.aspx but yes - Present will return D3DERR_DEVICELOST if there was a lost device.  The procedure is documented at http://msdn.microsoft.com/en-us/library/windows/desktop/bb174714%28v=vs.85%29.aspx (which is linked to from the MSDN page).

Share this post


Link to post
Share on other sites

Hmm, yeah, that's strange! I changed it to respond to a lost device if the Present() returns D3DERR_DEVICELOST rather than on WM_ACTIVATEAPP. Thanks!

Share this post


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

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!