   DirectInput mouse problems
  Well, I''m trying to design a generic manager to control DirectInput for a program, but the problem is that getDeviceState for the mouse always sets the lX and lY values to 0, so moving the cursor obviously doesn''t work.Here is the code where all the directinput stuff is initialized:DirectInputManager::DirectInputManager(HINSTANCE hIn, HWND hWn){//creates the directinput objectif (FAILED(DirectInput8Create(GetModuleHandle(NULL), DIRECTINPUT_VERSION,IID_IDirectInput8, (void**)&g_lpDI, NULL))){exit(1);}//creates the keyboardif (FAILED(g_lpDI->CreateDevice(GUID_SysKeyboard, &g_keyboard, NULL))){ exit(1); }//sets the standard data format for a keyboardif (FAILED(g_keyboard->SetDataFormat(&c_dfDIKeyboard))){ exit(1); }//sets the keyboard''s access level, can be used to restrict it to the programif (FAILED(g_keyboard->SetCooperativeLevel(hWn, DISCL_BACKGROUND | DISCL_NONEXCLUSIVE))){ exit(1); }//acquires the keyboardif (FAILED(g_keyboard->Acquire())){ exit(1); }//creates the mouseif (FAILED(g_lpDI->CreateDevice(GUID_SysMouse, &g_mouse, NULL))){ exit(1); }//sets the standard mouse data formatif (FAILED(g_mouse->SetDataFormat(&c_dfDIMouse))){ exit(1); }//sets the mouse access levelif (FAILED(g_mouse->SetCooperativeLevel(hWn, DISCL_FOREGROUND | DISCL_EXCLUSIVE))){ exit(1); }//acquire the mouseif (FAILED(g_mouse->Acquire())){ exit(1); }}  And here is where the input to the mouse is read:void DirectInputManager::getMouseInput(){HRESULT  hr;// Get the input''s device state, and put the state in dims    ZeroMemory( &dims, sizeof(dims) );    hr = g_mouse->GetDeviceState( sizeof(DIMOUSESTATE2), (LPVOID)&dims );    if( FAILED(hr) ){   // DirectInput may be telling us that the input stream has been   // interrupted.  We aren''t tracking any state between polls, so   // we don''t have any special reset that needs to be done.   // We just re-acquire and try again. // If input is lost then acquire and keep trying    hr = g_mouse->Acquire();   while( hr == DIERR_INPUTLOST )   hr = g_mouse->Acquire();}return;}  Both are basically copy n'' paste from the DX9SDK examples, so I don''t really know what could be going wrong. 
  after further examining the problem, this is the line that is failing:hr = g_mouse->GetDeviceState( sizeof(DIMOUSESTATE2), (LPVOID)&dims );the hr is producing a failed result, but the device is acquired. ;  bleh, I solved the problem.  It was using a datasource for DIMOUSESTATE, not DIMOUSESTATE2.  I really hate the microsoft DX tutorials. 