🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.windows.ms.programmer
Article #897

Re: Keeping a window "almost" in front

#897
From: Mike Deem
Date: Fri, 14 Dec 1990 17:54
16 lines
1246 bytes
In article <6252@hsv3.UUCP> jls@hsv3.UUCP (James Seidman) writes:
>
>So, I decided to be real clever:  I set hWndInsertAfter equal to
>GetFocus(), figuring that at least most of the time the window with
>the focus would be in front.  But doing this makes Windows hang as soon
>as it tries it!
>

You failed to take into account that, besides main appliction windows, controls
dialog boxes, menus, and a few other things are windows. GetFocus returns the
window that has the focus, which is most likely some control, not a top app.
window.

To do what you want, start with the window retuned by GetFocus, then its parent
window, etc. until you find a window that does NOT have the style WS_CHILD. 
This will be the top application window (how has a child that) has the focus.
Technical Details
Message-ID: <1155@banyan.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!wuarchive!sdd.hp.com!samsung!crackers!jjmhome!banyan!miked
References: <6252@hsv3.UUCP>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!wuarchive!sdd.hp.com!samsung!crackers!jjmhome!banyan!miked
From: miked@banyan.UUCP (Mike Deem@Eng@Banyan)
Newsgroups: comp.windows.ms.programmer
Subject: Re: Keeping a window "almost" in front
Message-ID: <1155@banyan.UUCP>
Date: 14 Dec 90 17:54:13 GMT
References: <6252@hsv3.UUCP>
Reply-To: miked@banyan.UUCP (Mike Deem@Eng@Banyan)
Organization: Banyan Systems, Inc.
Lines: 16