In Windows programming, I have an application that sits on the system
tray (see wordweb.info). I cannot find any 100% reliable way to get the
last active program when a user clicks on the icon. For example, if
someone was using IE, moved the mouse and clicked on my icon, I'd like
to get the handle to the IE window they are using.
I do not want to set up a system wide hook - there must be any easier
way! GetForegroundWindow on a mouse over event does return the right
handle, but you aren't guaranteed to get a mouse over event before the
click. I can kludge something that works most of the time, but I'd
like a simple reliable way to do it. |