Jump to content
  • Advertisement
Sign in to follow this  
sanjay1186

Problem in reading Joystick in DirectX9.0

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

I am using DirectInputDeviceMtthod to read joystick in coding,but program is not able to read joystick.
1. showing failure of two function:
if (FAILED(hr = joystick->GetDeviceState(sizeof(DIJOYSTATE2), js))) {
return hr; // The device should have been acquired during the Poll()
}
2. if( FAILED( UpdateInputState( hDlg ) ) )
{
KillTimer( hDlg, 0 );
MessageBox( NULL, TEXT( "Error Reading Input State. " ) TEXT( "The sample will now exit." ), TEXT( "DirectInput Sample" ),
MB_ICONERROR | MB_OK );
EndDialog( hDlg, TRUE );
}

This joystick code is in a program which i am using as a server.I am commun icating this server program to a client programt hrough loopback address(127.0.0.1) on a single computer.then error is there as mentioned above.i am trying to reading joystick at server side and sending to client.

if i am running both server and client program on two different computer then joystick is working.
what may be the reason.
I tried by setting joystick properties in this function
if (FAILED(hr = joystick->SetCooperativeLevel(NULL, DISCL_EXCLUSIVE |
DISCL_FOREGROUND))) {
return hr;
}

from
(NULL, DISCL_EXCLUSIVE | DISCL_FOREGROUND))) {
to
(NULL, DISCL_NONEXCLUSIVE | DISCL_BACKGROUND))) {

but no success!
Help
Thnx in Advance!

Share this post


Link to post
Share on other sites
Advertisement
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!