Reputation: 1666
I need to know when my Window goes out of input focus, so I overloaded the OnKillFocus() method of the CWnd.
However it doesn't invoke this method when I focus another application (alt+tab), or even minimize the window. But it DOES invoke the method when I restore it from being minimized. Are these the intended times for it to trigger this method?
Upvotes: 3
Views: 2286
Reputation: 2196
OnKillFocus() is normally only used consistently for controls that have a concept of gaining the focus - buttons, edit boxes, list boxes, etc. Normally CWnd does not accept the focus, so you can't rely on that - I'm surprised you get it at all.
In addition to WM_ACTIVATEAPP
mentioned above, there's also WM_ACTIVATE
when switching between windows within the same application you might want to trap.
Upvotes: 1
Reputation: 3151
I think you'll need a CWnd::OnActivateApp() handler if you need to be sure of being notified when your application is switched out.
Upvotes: 1