Archived

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

deactivating kb when window deactivated

This topic is 6359 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 switch to another program, say, winamp, and my program is running, the arrow keys would affect both the winamp bar, AND my program inputs. how do i prevent this? (how do i deactivated the keyboard for the inactive window?) a2k

Share this post


Link to post
Share on other sites
Well, DirectInput checks the keyboard scan codes, so you can do two things that I know of:

Either shut down DirectInput and bring it back up when the program is re-activated (stupid idea, IMHO, too much work).

What would be better, is to just not read the keyboard when you''re minimized. Look into handling the WM_ACTIVATEAPP windows message so your program doesn''t do anything when minimized. Kinda like pausing it, and not checking input until it''s reactivated.

I hope this is what you needed.

Share this post


Link to post
Share on other sites
sorta. i''m not using direct input yet, but for now, i just added another bool inputs = FALSE when WM_ACTIVE(wparam) is false, and inputs = TRUE when WM_ACTIVE(wparam) is true. (of course, this syntax is wrong, but you get the idea). thanks anyway.

a2k

Share this post


Link to post
Share on other sites