Sign in to follow this  
sanjay1186

Problem in reading Joystick in DirectX9.0

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

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