Sign in to follow this  

[SOLVED]MDX: DirectInput is crashing when Im trying to retrieve the CurrentMouseState

Recommended Posts

Hey!! Im trying to retrieve input via DirectInput. The keyboard-data is no problem, but when I want to update the mouse my program crashes. Here is what I've got:
// Initialization
           mouseDevice = new Microsoft.DirectX.DirectInput.Device(SystemGuid.Mouse);
           mouseDevice.Properties.AxisModeAbsolute = true;

// called bevore rendering
     public void Poll()
            MouseState state = mouseDevice.CurrentMouseState;  // Crash on the first method-call
            byte[] buttons = state.GetMouseButtons();

An unhandled exception of type 'Microsoft.DirectX.DirectInput.NotAcquiredException' occurred in Microsoft.DirectX.DirectInput.dll Additional information: Error in the application.
I have no idea. Could it be possible that it is a mistake to the same inputdevice-class for keyboard and mouse?
        private Microsoft.DirectX.DirectInput.Device mouseDevice = null;
        private Microsoft.DirectX.DirectInput.Device keyboardDevice = null;

? Thanks for helping [Edited by - Delryn on April 25, 2006 12:23:11 PM]

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this