Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.

The Frugal Gourmet

Managed DirectInput Event Problem

This topic is 5535 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

I have a somewhat bizarre problem I was hoping you gurus might be able to help me with. I initialize DirectInput with event notification in the same way suggested in the SDK (below, from SDK):

        private void frmUI_Load(object sender, System.EventArgs e)
            threadData = new Thread(new ThreadStart(this.MouseEvent));

            eventFire = new AutoResetEvent(false);
			// Create the device.
                applicationDevice = new Device(SystemGuid.Mouse);
                MessageBox.Show("Unable to create device. Sample will now exit.");
			// Set the cooperative level for the device.
			applicationDevice.SetCooperativeLevel(this, CooperativeLevelFlags.NonExclusive| CooperativeLevelFlags.Foreground);
            // Set a notification event.    
            // Acquire the device.
            try{ applicationDevice.Acquire(); }

However, I noticed a bizarre problem using a standard C# form. Whenever I *minimize* the window, my mouse event no longer fires after it is restored and I reacquire the device. Ever. If I alt-tab away from the window, however, the event keeps working after I reaquire the device. To try and figure out my problem, I loaded up the SDK example "scrawl" which utilizes the same standard C# form. I noticed that it has the EXACT SAME issue. So, to try and solve the problem, I loaded the C++ version of the same "scrawl" code. Inexplicably, it works perfectly. Anyone have any idea how I can get my event handler to recognize mouse movement after I minimize the form? [edited by - The Frugal Gourmet on May 28, 2003 9:07:48 PM]

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!