Handle of previous (non-dolphin) Window

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Handle of previous (non-dolphin) Window

David Royal-2
Does anyone know a reliable way to get a handle to the previously active
Window ( not dolphin managed) .
The scenario is that I have an app which runs as a hidden window with an
icon in the tray bar - when the tray icon is clicked a menu pops up giving
options to paste predefined strings of text into the last active window. I
need a reliable way of getting a handle to the last window and cannot see an
easy way to do this. WindowFromPoint is too hit and miss and FindWindow does
not work because text in the window caption changes and also the class name
seems to change from session to session. GetForegroundWindow shows the
active Dolphin Window.
TIA
David


Reply | Threaded
Open this post in threaded view
|

Re: Handle of previous (non-dolphin) Window

David Royal-2
This is still confusing me :-)

A search of MSDN and Google newsgroup search turned up very little new
except that a lot of people have trouble with this problem ( and no
solutions seem to work).
The most likely answer seemed to be WM_ACTIVATE which is meant to send the
handle of the deactivating window in lParam to the activating window. I
overode this message in my view to get this value but when run from the
Development Environment the handle of the previously active Dolphin window
is returned. I thought this may be Heisenberg in action so deployed the app
bbut now whenever my app is activated the handle to the previous window is
returned as 0.

Does anyone have any ideas please?

"David Royal" <[hidden email]> wrote in message
news:aCv_8.144$[hidden email]...
> Does anyone know a reliable way to get a handle to the previously active
> Window ( not dolphin managed) .
> The scenario is that I have an app which runs as a hidden window with an
> icon in the tray bar - when the tray icon is clicked a menu pops up giving
> options to paste predefined strings of text into the last active window. I
> need a reliable way of getting a handle to the last window and cannot see
an
> easy way to do this. WindowFromPoint is too hit and miss and FindWindow
does
> not work because text in the window caption changes and also the class
name
> seems to change from session to session. GetForegroundWindow shows the
> active Dolphin Window.
> TIA
> David
>
>