Yeah I'm pretty sure it's the problem. Here's my code: (mouse_offset_* are floats, *_angle are floats)
GetCursorPos(&mouseloc);
GetClientRect(hWnd, &rc);
ScreenToClient(hWnd, &mouseloc);
mouse_offset_x = (float)rc.right / 2.0f;
mouse_offset_y = (float)rc.bottom / 2.0f;
mouse_offset_x -= (float)mouseloc.x;
mouse_offset_y -= (float)mouseloc.y;
x_angle -= ((mouse_offset_x / 5000) * mouseSensitivity);
y_angle -= ((mouse_offset_y / 5000) * mouseSensitivity);
if(x_angle > (2.0f * D3DX_PI))
x_angle = 0;
if(x_angle < 0)
x_angle = (2.0f * D3DX_PI);
y_angle = __max(-D3DX_PI / 2.0f, y_angle);
y_angle = __min(+D3DX_PI / 2.0f, y_angle);
D3DXMatrixRotationYawPitchRoll(&mat, x_angle, y_angle, 0.0f);
D3DXVec3TransformCoord(&vAhead, &vNorth, &mat);
D3DXVec3TransformCoord(&vAbove, &vUp, &mat);
D3DXVec3TransformCoord(&vLeft, &vWest, &mat);
D3DXMatrixRotationYawPitchRoll(&mat, x_angle, 0.0f, 0.0f);
D3DXVec3TransformCoord(&vAheadWalk, &vNorth, &mat);
vLookAtPt = vEyePt + vAhead;
D3DXMatrixLookAtLH(&mat2, &vEyePt, &vLookAtPt, &vAbove);
cGraphics->setTransform(D3DTS_VIEW, &mat2);
mouseloc.x = rc.right / 2;
mouseloc.y = rc.bottom / 2;
ClientToScreen(hWnd, &mouseloc);
SetCursorPos(mouseloc.x, mouseloc.y);