win32gui question - is my window the foreground window?

Linus Chang Linus_Chang1 at bigpond.com
Sun Jun 18 01:50:10 EDT 2000




Neurocrat wrote:

> Linus Chang <Linus_Chang1 at bigpond.com> writes:
> > 
> > I'd like to detect if the window of my wxPython application is currently 
> > the foreground window.
> > 
> 
> Could you elaborate on this?  Are you trying to determine whether your
> application's main window is at the top of the Z-order? Are you trying
> to determine this from *within* your application, or from another
> process?

Sorry I wasn't more specific. I'm trying to tell from within my own 
application, whether my application is the currently foreground 
application. (ie. the one that's got focus; it's "rectangle" [I can't 
think of the proper term] in the task bar is the one that's depressed.) 
It doesn't really matter whether my app's main window or some child 
window of my app is at the top of the Z-order. But as far as I can tell, 
the foreground app always has its main window (or a child) at the top of 
the Z-order, but I'm not a low level windows gui buff!!

eg. If you've ever used Microsoft Instant Messenger, when a message 
arrives and Instant Messenger is not the currently active window, then 
the app's taskbar "rectangle" flashes and a sound plays. I'd like 
similar functionality in my application. I haven't found an API call to 
make it flash (under Win98 and Win2000 (not NT4) it can be done 
automatically by SetForegroundWindow, since Win98 and Win2000 doesn't 
let you SetForegroundWindow under certain circumstances), but I'm taking 
this one step at a time - detecting if my app is the foreground one is a 
good start!

Thanks,

Linus







More information about the Python-list mailing list