Jump to content

  • Log In with Google      Sign In   
  • Create Account


TestCooperativeLevel causing exception


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
7 replies to this topic

#1 george7378   Members   -  Reputation: 1185

Like
0Likes
Like

Posted 03 April 2013 - 07:22 AM

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():

 

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!



Sponsor:

#2 Dawoodoz   Members   -  Reputation: 294

Like
1Likes
Like

Posted 03 April 2013 - 07:37 AM

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


Edited by Dawoodoz, 03 April 2013 - 07:39 AM.

My open source DirectX 10/11 graphics engine. https://sites.google.com/site/dawoodoz

"My design pattern is the simplest to understand. Everyone else is just too stupid to understand it."


#3 mhagain   Crossbones+   -  Reputation: 7578

Like
1Likes
Like

Posted 03 April 2013 - 07:42 AM

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, 03 April 2013 - 07:48 AM.

It appears that the gentleman thought C++ was extremely difficult and he was overjoyed that the machine was absorbing it; he understood that good C++ is difficult but the best C++ is well-nigh unintelligible.


#4 hikrea   Members   -  Reputation: 161

Like
1Likes
Like

Posted 03 April 2013 - 08:00 AM

Is you d3ddev valid?



#5 Matias Goldberg   Crossbones+   -  Reputation: 3043

Like
1Likes
Like

Posted 03 April 2013 - 08:58 AM

d3ddev is a null pointer

#6 george7378   Members   -  Reputation: 1185

Like
0Likes
Like

Posted 03 April 2013 - 09:42 AM

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?



#7 mhagain   Crossbones+   -  Reputation: 7578

Like
1Likes
Like

Posted 03 April 2013 - 11:03 AM

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).


It appears that the gentleman thought C++ was extremely difficult and he was overjoyed that the machine was absorbing it; he understood that good C++ is difficult but the best C++ is well-nigh unintelligible.


#8 george7378   Members   -  Reputation: 1185

Like
0Likes
Like

Posted 03 April 2013 - 11:33 AM

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!






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS