Jump to content
  • Advertisement
Sign in to follow this  
BloodLust666

program in background

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

in DirectInput, I have it so the coorporate levels are background and nonexclusive. how do i make it so when the program is no in the foreground, to not pick up any key strokes?

Share this post


Link to post
Share on other sites
Advertisement
From the SDK documentation:

Quote:

DISCL_FOREGROUND
The application requires foreground access. If foreground access is granted, the device is automatically unacquired when the associated window moves to the background.


So I think the states you are looking for are DISCL_NONEXCLUSIVE | DISCL_FOREGROUND, but I cannot try it right now so can't be 100% sure.

Share this post


Link to post
Share on other sites
i dont' know if that works b/c whenever i lose focus to my application it looks like it does the code as if i pressed Esc key (it shutdown everything and closes). y does it do that? (in foreground and nonexclusive)

so i need to have it is background, is there m/b an if statement i can put in my Read() function that says, if (window in focus) read keyboard if (not) don't read keyboard?

Share this post


Link to post
Share on other sites
Right - are you saying that when you lose window-focus, your app closes?

This sounds suspiciously like the application is crashing - possibly due to a failed call to DInputDevice->Acquire().

Test to see what is actually happening to your application. Check all return results from all DInput calls and break/return if neccasary.

Share this post


Link to post
Share on other sites
well, my mistake, it doesn't close.. it acts as if all keys were pressed. in my code i have if the Esc key was pressed then exit. b/c if it just exitted i would get an error saying some stuff wasn't released and it doesn't say that so i know it's getting released...

Share this post


Link to post
Share on other sites
ok, now i KNOW that's what it's doing b/c in my shutdown code i did Log.Write("shutdown") to my errorlog file and when i lost focus and the app. closed, the word "shutdown" was in the file.

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.

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!