Sign in to follow this  
falola45

Loosing mouse foucs in with DirectInput

Recommended Posts

When i alt tab out of my program and go back in i loose mouse focus, and i don't know why, i have a check input fucntion which acquires and gets the device data every frame but for some reason i still loose the focus, even if i poll the device first. If anyone can tell me how to fix it that would be great!!!

Share this post


Link to post
Share on other sites
From direct input mouse sample:

Quote:

Foreground cooperative level means that the application has access to data only when in the foreground or, in other words, has the input focus. If the application moves to the background, the device is automatically unacquired, or made unavailable.

Background cooperative level really means foreground and background. A device with a background cooperative level can be acquired and used by an application at any time.

Exclusive mode prevents other applications from also acquiring the device exclusively. The fact that your application is using a device at the exclusive level does not mean that other applications cannot get data from the device. Windows itself requires exclusive access to the mouse because mouse events such as a click on an inactive window could force an application to unacquire the device, with potentially harmful results, such as a loss of data from the input buffer. Therefore, when an application has exclusive access to the mouse, Windows is not allowed any access at all. No mouse messages are generated. A further side effect is that the cursor disappears. When accessing the menu, the sample releases the mouse so the mouse is displayed again.

Nonexclusive mode means that other applications can acquire device in exclusive or nonexclusive mode.

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