what window lost focus


David Ellis

I am working on an on-screen keyboard. To do so, I need to know what window
had the focus prior to my window getting it. It is my understanding that the
wParam no longer has the handle of the window that has lost the focus if
that window is from another thread.

I am aware that I can call GetForegroundWindow to find out the foreground
window and use AttachThreadInput to allow me to call GetFocus. This works
but I need to call GetForegroundWindow prior to my window getting focus. Is
there a message that is always sent to a window just before it gets the
focus while the previous window still has the focus?





Could you set a hook with HCBT_ACTIVATE and use the hWndActive member of the
CBTACTIVATESTRUCT to get a handle to the window about to be deactivated?


Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question