jls@hsv3.UUCP (James Seidman) (11/20/90)
There are a bunch of utilities (such as clocks, free-memory indicators, etc.) which keep a window promoted in front of everything else. I was wondering what the best way to do this is. After some poking around with SPY, the only message I can find which is somewhat reliably produced when a window is covered is WM_NCPAINT. (This in itself seems strange... it's not like part of the window is being exposed, just covered.) Is there a better way to keep a window promoted than to do a ShowWindow() on every WM_NCPAINT message? -- Jim Seidman (Drax), the accidental engineer. "It doesn't have to work... they'll be paralyzed just from laughing at me." - Dr. Who, _Shada_ UUCP: ames!vsi1!hsv3!jls INTERNET: hsv3.UUCP!jls@apple.com
kensy@microsoft.UUCP (Ken SYKES) (11/21/90)
How about WM_KILLFOCUS? If your app has the focus it is certainly on top. If the focus changes use SetWindowPos to make sure the Z ordering is maintained. Ken Sykes Disclaimer: The above opinions are solely my own.
jseidman@jarthur.Claremont.EDU (James Seidman) (11/27/90)
kensy@microsoft.UUCP (Ken SYKES) writes: >How about WM_KILLFOCUS? If your app has the focus it is certainly on top. >If the focus changes use SetWindowPos to make sure the Z ordering is >maintained. However, just doing a SetWindowPos() on WM_KILLFOCUS won't insure that a window stays in front. Take the case that my app has already lost focus. Now someone moves another window in front of it. I need some way to detect that that's happened, and I don't see any appropriate WM message which does that. -- Jim Seidman, Headland Technology, 46221 Landing Parkway, Fremont CA 94538 "If I screw up, I just kill someone. But if you screw up, they suffer for the rest of their lives." - A remark made by a surgeon to a psychiatrist.
spolsky-joel@cs.yale.edu (Joel Spolsky) (11/27/90)
In article <9816@jarthur.Claremont.EDU> jseidman@jarthur.Claremont.EDU (James Seidman) writes: >However, just doing a SetWindowPos() on WM_KILLFOCUS won't insure that a >window stays in front. Take the case that my app has already lost focus. >Now someone moves another window in front of it. I need some way to detect >that that's happened, and I don't see any appropriate WM message which does >that. You seem to be right; a window that is newly-covered up doesn't know about it. Perhaps you could have a timer wake you up every second and make sure you are in front? Or else use a system-wide hook to intercept all messages; this will slow things down dreadfully. However I don't think checking once a second will be a big CPU drain... Joel Spolsky disclaimer; i barely even speak for myself
richardh@hpopd.HP.COM (Richard Hancock) (11/27/90)
I'm not sure that a "system-wide hook would slow things down dreadfully". Provided the hook function is doing very little it should hardly have any effect at all. Recommendation : try it.