Skip to main content
GameDev.net gamedev.net
🔒 Locked

DirectInput focus-question/problem

Started by EinVante Dec 13, 2002 at 3:47 PM 0 replies 1k views
Original Post
EinVante
EinVante
Well I have a small and easy problem right now and I can''t seem to find any good source on how to resolve it. My problem is that DirectInput translates all keyboard-input it gets and my program starts to run wild whenever I switch windows and things like that. I know that the solution would be to only handle input when the window is in focus(active) but as I stated earlier I can''t find any good information on how to do it(the function for it). So what I''m searching for is simply something that will tell me if the windows is in focus or not, can anybody help me with this simple problem?
IFooBar
IFooBar
you''ll have to handle the WM_ACTIVATE messages in your maeesage handler if you want to know when your app is in focus and when it isnt.

  
case WM_ACTIVATE:
switch(wParam)
{
case WA_ACTIVE:
g_pApp->activateApplication(TRUE);
break;
case WA_CLICKACTIVE:
g_pApp->activateApplication(TRUE);
break;
case WA_INACTIVE:
g_pApp->activateApplication(FALSE);
break;
}



:::Al:::
[Triple Buffer V2.0] - Resource leak imminent. Memory status: Fragile
[size=2]aliak.net

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.