Jump to content
  • Advertisement
Sign in to follow this  
vcGamer

wrong mouse input

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

Hi everybody

I'm working on my project (a multidocument win32 app) using VS2008 & managed DX. My project is something like NASA world wind which tries to simulate earth, of course my application has the ability to show several windows. Like nasa worldwind I use mouse wheel for performing zooming actions, (of course I use Direct Input in order to get mouse Input), but mouse actions (especially mouse wheel rotation) is always active regardless of which program has focus. For instance when I switch to NASA and perform a zoom-in action, my own program receives this also and performs a zoom-in. How can I solve it?

thanks in advance

Share this post


Link to post
Share on other sites
Advertisement
Quote:
Original post by vcGamer(of course I use Direct Input in order to get mouse Input)


There is your problem. Using DirectInput for keyboard/mouse input is not recommended and you should rely on standard Windows messages whenever possible.

Share this post


Link to post
Share on other sites
Are you calling the SetCooperativeLevel function to determine when to receive the input? Make sure you call it with the flags:
DISCL_NONEXCLUSIVE | DISCL_FOREGROUND
Using DISCL_BACKGROUND means the mouse is polled even while you're working in other applications.

If this doesn't solve your problem, then you can use GetForegroundWindow() to determine whether to process inputs or not. But like the above poster said, using the message loop to handle mouse input is easier than using DirectInput.

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!