Home All Groups Group Topic Archive Search About

Find the Topmost window?

Author
8 Mar 2006 7:26 PM
software.helpdesk
Well I've spent an hour looking through the posts in the group and I
can't seem to find an answer.

Can anyone give me a pointer on how to find the topmost window (hwnd or
title), for example the window that has been highlighted using ALT-TAB?

Thanks
James

Author
8 Mar 2006 7:29 PM
Karl E. Peterson
software.helpd***@gmail.com wrote:
> Well I've spent an hour looking through the posts in the group and I
> can't seem to find an answer.
>
> Can anyone give me a pointer on how to find the topmost window (hwnd
> or title), for example the window that has been highlighted using
> ALT-TAB?

GetForegroundWindow()
--
Working without a .NET?
http://classicvb.org/
Author
8 Mar 2006 7:49 PM
Tom Esh
On 8 Mar 2006 11:26:07 -0800, software.helpd***@gmail.com wrote:

>Can anyone give me a pointer on how to find the topmost window (hwnd or
>title), for example the window that has been highlighted using ALT-TAB?

Those two things may not be the same, specifically in the case where
an app has designated one of its windows to be topmost a.k.a. "always
on top". However the GetForegroundWindow API function will fetch the
hwnd of the top-level window that is currently "active" (iow the one
with KB focus per the alt+tab switcher).



-Tom
MVP - Visual Basic
(please post replies to the newsgroup)
Author
9 Mar 2006 12:18 PM
jameshamilton777
Thanks guys.