deactivating kb when window deactivated

Started by
1 comment, last by a2k 23 years, 9 months ago
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
------------------General Equation, this is Private Function reporting for duty, sir!a2k
Advertisement
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.
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
------------------General Equation, this is Private Function reporting for duty, sir!a2k

This topic is closed to new replies.

Advertisement