Jump to content
  • Advertisement
Sign in to follow this  
falola45

Loosing mouse foucs in with DirectInput

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

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
Advertisement
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
ok, i got it to work with the background mode, i need to use the show cursor win32 function to hide the windows cursor while in the app...thanks

Share this post


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

  • Advertisement
×

Important Information

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

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!