I have no experience with joyGetPosEx, so I'm not sure that the code is correct. But maybe a user can help?