By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,766 Members | 1,432 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,766 IT Pros & Developers. It's quick & easy.

undefined SW_MAXIMIZE for ShowWindow function

P: n/a
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?

Jul 14 '06 #1
Share this Question
Share on Google+
6 Replies


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

Etayki wrote:
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?
Jul 14 '06 #2

P: n/a

[Etayki]
How do I get SW_MAXIMIZE to be defined?
It's in win32con. Like this:
>>from win32con import *
SW_MAXIMIZE
3

--
Richie Hindle
ri****@entrian.com
Jul 14 '06 #3

P: n/a
"Etayki" <et*****@gmail.comwrote:
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>

Jul 14 '06 #4

P: n/a
>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>

Jul 14 '06 #5

P: n/a

[Etayki]
OK, so it it turns out, the window will maximize when SW_MAXIMIZE =3.
But where can I find some documentation for that?
ShowWindow is a Win32 API call, so Googling within msdn.microsoft.com will
usually get you straight to the relevant documentation:

http://www.google.com/search?q=ShowW....microsoft.com

--
Richie Hindle
ri****@entrian.com
Jul 14 '06 #6

P: n/a

[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.

--
Richie Hindle
ri****@entrian.com
Jul 14 '06 #7

This discussion thread is closed

Replies have been disabled for this discussion.