Jump to content
  • Advertisement
Sign in to follow this  
MTclip

direct input Aquire()..... not working

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

ok i am having problems re Aquireing my direct input keyboard and mouse.. here is my update()
/// KEYBOARD

m_pDirectInputKeyboardDevice->Acquire();  // this may seem wierd but the sdk said extra call of this are ignored... 
hr = m_pDirectInputKeyboardDevice->GetDeviceState(sizeof(m_KeyBuffer),(LPVOID)&m_KeyBuffer);
if(FAILED(hr))// if failed reaquire and try again
{
	while( hr == DIERR_INPUTLOST ) // ive also tried FAILED(hr)
	{         
		hr = m_pDirectInputKeyboardDevice->Acquire();
	}
	//HandleHRESULT(m_pDirectInputKeyboardDevice->GetDeviceState(sizeof(m_KeyBuffer2),(LPVOID)&m_KeyBuffer2),"FAILED TO REAQUIRE KEYBOARD")
	m_pDirectInputKeyboardDevice->GetDeviceState(sizeof(m_KeyBuffer2),(LPVOID)&m_KeyBuffer2);

}

/// MOUSE

m_pDirectInputMouseDevice->Acquire();
hr = m_pDirectInputMouseDevice->GetDeviceState(sizeof(m_MouseState),(LPVOID)&m_MouseState);
if(FAILED(hr))// if failed reaquire and try again
{
	while( hr == DIERR_INPUTLOST ) 
	{         
		 hr = m_pDirectInputMouseDevice->Acquire();
	}
	m_pDirectInputMouseDevice->GetDeviceState(sizeof(m_MouseState),(LPVOID)&m_MouseState)
}

what have i done wrong.....

Share this post


Link to post
Share on other sites
Advertisement
Hmmm, so what is the returned error from Aquire? is it always DIERR_INPUTLOST?

the way i reaqurie my devices is similar to yours, you could try and see if ti makes any difference

hr = m_pMouse->GetDeviceState( sizeof( _DIMOUSESTATE2 ), m_currMouseState );

if( FAILED(hr) ) {
do {
hr = m_pMouse->Acquire();
}
while( hr == DIERR_INPUTLOST );

return( true );
}



Hope this helps....

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!