undefined SW_MAXIMIZE for ShowWindow function

Fredrik Lundh fredrik at pythonware.com
Fri Jul 14 10:11:01 EDT 2006


"Etayki" <etayluz at gmail.com> wrote:

> I'm trying to maximize a IE window. I have a handler and I'm trying to
> call ShowWindow to maximize it:
>
> ie = Dispatch('InternetExplorer.Application')
> handler = ie.HWND
> ie.Visible = 1
> win32gui.ShowWindow(handler, SW_MAXIMIZE)
>
> But then I get this error:
> 'SW_MAXIMIZE' is not defined

SW_MAXIMIZE is a C preprocessor constant (a define), which means it
only exists in a Windows-specific header file (winuser.h, in this case).

> How do I get SW_MAXIMIZE to be defined?

by grepping through the Windows header files to see what the corresponding
value is, and using that value to set a Python variable in your script:

    > grep SW_MAXIMIZE *.H
    WINUSER.H:#define SW_MAXIMIZE         3

corresponds to

    SW_MAXIMIZE = 3

</F> 






More information about the Python-list mailing list