|Microsoft DirectX 9.0|
If your application is using the joystick in foreground mode (see Cooperative Levels), it will lose the device when the focus shifts to another application.
Check for the DIERR_INPUTLOST return value from the IDirectInputDevice8::GetDeviceData or the IDirectInputDevice8::GetDeviceState method and attempt to reacquire the joystick, if necessary. (See Acquiring Devices.)
Because access to the joystick is not lost except when your application moves to the background—unlike the mouse and keyboard, the joystick is never used by the Microsoft?Windows?system—an alternative method is to reacquire the device in response to a WM_ACTIVATE message.