undefined SW_MAXIMIZE for ShowWindow function

E

Etayki

Hi!

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

The function ShowWindow is defined (according to MSDN) as:

BOOL ShowWindow( HWND hWnd,
int nCmdShow
);

How do I get SW_MAXIMIZE to be defined?
 
E

Etayki

OK, so it it turns out, the window will maximize when SW_MAXIMIZE =3.
But where can I find some documentation for that?
 
F

Fredrik Lundh

Etayki said:
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>
 
F

Fredrik Lundh

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

oops. thought you were using ctypes, not the pythonwin extensions. see richie's
reply for pythonwin details.

</F>
 
R

Richie Hindle

[Fredrik]
oops. thought you were using ctypes, not the pythonwin extensions.

Even when I'm using ctypes I use win32con for the constants, unless
there's some special reason why I need the code to be independent of
pywin32.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,431
Messages
2,571,677
Members
48,796
Latest member
Greg L.

Latest Threads

Top