Sign in to follow this  

Problem in reading Joystick in DirectX9.0

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

This topic is 2595 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this