[python-win32] how to activate subwindow of the application ???

Tim Golden mail at timgolden.me.uk
Mon May 12 10:16:09 CEST 2008


neha rai wrote:
> First time the window is opened by the user, user can pick any window on
> which it needs to work (in my case window are is subwindow of a application)

You're not making life easy here by your varied use of the term "window".

> My code identifies the window by using :
> hand=win32gui.GetForegroundWindow()
> My code performs action on the window and closes it.. now i want it to open
> automatically.

OK. I think I see what you're talking about. You're saying that you are, in
some way, monitoring an application. Within the app the user
performs <Action X> (pressing a button, selecting a menu, etc) which
activates some window, perhaps a dialog box? They do whatever they do 
and finally take some other action which closes the window. You know what 
the window handle was but you don't know how to reopen it? Am I right?

I think you're stuck. In the absence of any code from your end, it's
nearly impossible to determine what the sequence of events is, and
it's not going to be easy to guess what action to take to initiate an
arbitrary window.

I'm assuming the application isn't one you control. You could, perhaps,
do *very* messy and low-level things like installing a message hook [1]
and attempting to infer what command or message initiated the window.
But I suspect from the level of your questions that you're in deep enough
as it is and I think you'd be out of your depth there.

TJG

[1] http://msdn.microsoft.com/en-us/library/ms632589(VS.85).aspx


More information about the python-win32 mailing list