How to get currently active window on Win32?
Mark Hammond
mhammond at skippinet.com.au
Sun Dec 16 08:24:11 EST 2001
David Brady wrote:
Wolfgang answered the first:
> Second question, it looks like PyCWnd supports all of
> the MFC functionality that I could want (including
> GetTopWindow, ahem) but I can't figure out how to get
> at a PyCWnd object. How can I call these MFC
> functions... or do I have to create a Win32 PyCWnd
> dialog in order to call from it?
You can call win32ui.CreateWindowFromHandle() if you just have the
handle. Otherwise you must create it.
> Third, is it possible to call GetWindowPlacement and
> SetWindowPlacement from Python? I'd like to write a
> script that manipulates the positions of my open
> windows.
the win32ui window objects have these functions. See the docs.
> Fourth (and last, phew!), is there a way to find out a
> window's class? FindWindow, for example, will look
> for a caption or a window class; it's more accurate to
> look for window classes (especially when you have six
Maybe FindWindowEx? I haven't got MSDN handy, but work out how to do it
from the MSDN/SDK documentation, and then do it in Python :)
Mark.
More information about the Python-list
mailing list