Program crashes when trying to get the device state of an mouse or keyboard in DX9.

Started by
3 comments, last by Lionheartadi 20 years, 9 months ago
Hi I have an odd problem. I use Direct Input for keyboard and mouse support and it works fine. You can move along the worlds look up and down etc, but then after a while the program crashes and when I intercept the crash with Visual Studio it shows me that when trying to get the keyboards or mouses state it crashes. Notice: It works fine for a while, but then suddenly crashes. Does might know why this occurs. I check the pointers and references to the device, but could not find any errors there. If anyone can give some tips, I will be gratefull. Thank you for any help.
Adrian Simionescu
Advertisement
Have you used debug DirectX runtime to see what debug spew DirectInput writes? If the pointer to the device is still good, what''s the error code/exception code returned by GetDeviceState()?
quote:Original post by jacklin
Have you used debug DirectX runtime to see what debug spew DirectInput writes? If the pointer to the device is still good, what''s the error code/exception code returned by GetDeviceState()?


Ok stupid question, but how do I enable DirecX debug mode so that it works in VS .NET. I did install the Debug version of DX when I installed the SDK, but don''t yet know how to enable it. I allso did marked a debug stated in the controal panels DX optionsm, but well dunno...
Adrian Simionescu
try

if(FAILED(Keyboard->GetDeviceState(sizeof(buffer),(LPVOID)&buffer))){    Keyboard->Acquire();    Keyboard->GetDeviceState(sizeof(buffer),(LPVOID)&buffer);}
TechleadEnilno, the Ultima 2 projectwww.dr-code.org/enilno
quote:Original post by Lionheartadi
Ok stupid question, but how do I enable DirecX debug mode so that it works in VS .NET. I did install the Debug version of DX when I installed the SDK, but don''t yet know how to enable it. I allso did marked a debug stated in the controal panels DX optionsm, but well dunno...


If you have installed the DX SDK properly, go to the DirectX control panel applet, and open the DirectInput page. Select "Use Debug Version of DirectInput" and adjust "Debug Output Level" towards right. Then under Debug Output Generators, check IDirectInputKeyboard and IDirectInputMouse.

Now you should see debug output from DirectInput when debugging your program. If not, increase "Debug Output Level" further.

This topic is closed to new replies.

Advertisement