Jump to content
  • Advertisement
Sign in to follow this  
Citizen Erased

Really weird DirectInput / C++ problem.

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

Whenever I add a new variable, be it local or global or as a class member, ANYTHING, my program crashes on these lines of code for the mouse using DI: code: DIMOUSESTATE mouse_state; if (FAILED(m_mouse->GetDeviceState(sizeof(DIMOUSESTATE), (LPVOID)&mouse_state))) { ::MessageBox(0, "m_mouse->GetDeviceState() - Not so good Al", 0, 0); ::PostQuitMessage(0); } Debugging tells me this: "An unhandled exception of type 'System.NullReferenceException' occurred in 3D Flying Thing.exe Additional information: Object reference not set to an instance of an object." and points to the if statement. The weird thing is, this only occurs if I add any new variables. At the moment with the amount I've got it's perfectly happy to work as it's supposed to but as soon as anything new is added, this happens. If I comment out the if statement the program will run fine with new variables. I am utterly stumped by this, it makes no sense (to me). There is no correlation between these variables and that if statment (that I can see) so why is this happening?

Share this post


Link to post
Share on other sites
Advertisement
I think I have experienced similar behaviour, I would suggest doing a recompile.


[Edited by - Aiursrage2k on June 9, 2006 12:16:35 PM]

Share this post


Link to post
Share on other sites
I've solved the problem, it was actually a memory problem brought about by string manipulation. Thanks anyway though.

[Edited by - Citizen Erased on June 9, 2006 5:24:10 PM]

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!