Jump to content
  • Advertisement
Sign in to follow this  
sipickles

Sudden DirectInput Error

This topic is 4483 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, Inexplicably, this error has started occuring in my directinput update() function: //This line.... result = m_mouse->GetDeviceState( sizeof( DIMOUSESTATE ), &m_mouseState ) // .. produces this result = 0x8007000c The access code is invalid. This happens for both mouse and keyboard. I traced this back to a problem during init, hr = m_keyboard->Acquire() produces E_ACCESSDENIED. The rest of the init code returns S_OK, like DirectInput8Create and CreateDevice. I thought maybe a previous error meant the devices has never been released, but it still occurs after a reboot. I've not been meddling with the input side of the app, so am surprised to see this error suddenly occur... ok, not that surprised :) Thanks for your help Simon

Share this post


Link to post
Share on other sites
Advertisement
First, it would be wise to have your DI initialization routine return an error if anything fails in it, rather than continuing anyway and later find out the hard way in your "update" procedure. At any rate, I would try to run the keyboard sample which comes with the SDK. If that runs fine, then try to rewrite your code to more closely resemble the sample code. Hope this helps.

Share this post


Link to post
Share on other sites
I have checked my DI init routine against the SDKs and its identical. I still get that E_ACCESSDENIED error on the acquire call!

Any ideas peeps?

Ta!

Si

Share this post


Link to post
Share on other sites
Have you tried running with the debug DInput runtimes cranked up to maximum?

Things like this dont tend to "just happen" - as hard as it might be, back-tracking through *ANY* recent changes to your code or system - however irrelevant is usually your best starting point. It's not happened recently, but I have killed my code via Windows Updates / Driver changes occasionally. Something I was doing is no longer valid with the updated system software = Kamboom!

hth,
Jack

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
I think it just happens.
I am not near a computer with my code, so I will have to tell what I remember.
You just need to put the acquire in a loop. Because some errors like this just happen. Usually because the device get lost or something like this.
If you are unable to reacquire the device in a loop after a while, then you have aproblem.

Share this post


Link to post
Share on other sites
Well, I seem to have it working.

Originally I was using

m_mouse->SetDataFormat( &c_dfDIMouse );

This worked fine for a long time.

Now I have used:

m_mouse->SetDataFormat( &c_dfDIMouse2 );

as in the SDK sample, which seems to have recovered the error. The second format is for mouses with loads of buttons I believe.

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!