• Advertisement
Sign in to follow this  

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

This topic is 4321 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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();
        }



Quote:
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
Advertisement
You need to Acquire the device before you can use it.

e.g. mouseDevice.Acquire();

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement