Vickio
asked on
wm_activate - why is hwndPrevious null?
hey..
i need to get the handle of the window that is taking focus from my window... wm_activate is what i should use but hwndPrevious is always null..
docs say that 'This handle can be NULL' which doesnt tell me a whole lot :)
what do i do to get the hwnd?
thanks
-vickio
i need to get the handle of the window that is taking focus from my window... wm_activate is what i should use but hwndPrevious is always null..
docs say that 'This handle can be NULL' which doesnt tell me a whole lot :)
what do i do to get the hwnd?
thanks
-vickio
ASKER
hmm, yeah your right, the window being activated must be of the same process....
calling GetActiveWindow doesnt work though cause WM_ACTIVATE is called before the window loses focus...
anyone else have an idea on how i can do this? if not i'll give JMu the points.
-vickio
calling GetActiveWindow doesnt work though cause WM_ACTIVATE is called before the window loses focus...
anyone else have an idea on how i can do this? if not i'll give JMu the points.
-vickio
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
cool, GetForegroundWindow works perfect :)
thanks
-vickio
thanks
-vickio
GetFocus() maybe of assistance - the return value is the handle to the window with the keyboard focus. If the calling thread's message queue does not have an associated window with the keyboard focus, the return value is NULL.
Even if GetFocus returns NULL, another thread's queue may be associated with a window that has the keyboard focus.
Use the GetForegroundWindow function to retrieve the handle to the window with which the user is currently working. You can associate your thread's message queue with the windows owned by another thread by using the AttachThreadInput function.
Let me know how you go
DarrinE
Even if GetFocus returns NULL, another thread's queue may be associated with a window that has the keyboard focus.
Use the GetForegroundWindow function to retrieve the handle to the window with which the user is currently working. You can associate your thread's message queue with the windows owned by another thread by using the AttachThreadInput function.
Let me know how you go
DarrinE
You could try GetActiveWindow in WM_ACTIVATE.
JMu