Advertisement Jump to content


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


Direct Input Question

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

Hey. I need to addsomething to my DInput wrapper class to reaquirer my DI devices (eg mouse and keyboard) after they're unaquired. I looked on MSDN, but it doidnt give me a solid answer to this. Would i just detect the error 'DIERR_NOTAQUIRED' and then simply call the function 'SomeDevice->Acquire();' or should i go through the entire initialisation functions to get it back? Which other error codes would need to make the game reaquirer devices. DIERR_INPUTLOST? thx, -J EDIT: BTW: its version 8.1 i'm using. [edited by - jason2jason on February 8, 2003 4:41:41 PM]

Share this post

Link to post
Share on other sites
yeah basically you just check if GetDeviceState failed. If it did
you try to acquire, but if that fails, you can enter a loop of acquiring while the error code is DIERR_INPUTLOST || hr == DIERR_NOTACQUIRED.

HRESULT hr = pDevice->GetDeviceState(256, keyBuffer);

if( FAILED( hr ) )
hr = m_pKeyboardDevice->Acquire();
hr = pDevice->Acquire();

Of course you can use different loginc, but that's basically it.

:::: [ Triple Buffer V2.0 ] ::::

[edited by - IFooBar on February 8, 2003 4:51:29 PM]

Share this post

Link to post
Share on other sites
One additional note. You need not call the Create functions but once. Once they successfully create the device or the DirectInput object, you don''t want to call them again unless you destroy them properly. Besides it''s extra work and wholly unnecessary to accomplish what your trying to do.


Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!