undefined SW_MAXIMIZE for ShowWindow function

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Etayki

    undefined SW_MAXIMIZE for ShowWindow function

    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('Inter netExplorer.App lication')
    handler = ie.HWND
    ie.Visible = 1
    win32gui.ShowWi ndow(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?

  • Etayki

    #2
    Re: undefined SW_MAXIMIZE for ShowWindow function

    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('Inter netExplorer.App lication')
    handler = ie.HWND
    ie.Visible = 1
    win32gui.ShowWi ndow(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?

    Comment

    • Richie Hindle

      #3
      Re: undefined SW_MAXIMIZE for ShowWindow function


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

      --
      Richie Hindle
      richie@entrian. com

      Comment

      • Fredrik Lundh

        #4
        Re: undefined SW_MAXIMIZE for ShowWindow function

        "Etayki" <etayluz@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('Inter netExplorer.App lication')
        handler = ie.HWND
        ie.Visible = 1
        win32gui.ShowWi ndow(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:#defi ne SW_MAXIMIZE 3

        corresponds to

        SW_MAXIMIZE = 3

        </F>



        Comment

        • Fredrik Lundh

          #5
          Re: undefined SW_MAXIMIZE for ShowWindow function

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



          Comment

          • Richie Hindle

            #6
            Re: undefined SW_MAXIMIZE for ShowWindow function


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



            --
            Richie Hindle
            richie@entrian. com

            Comment

            • Richie Hindle

              #7
              Re: undefined SW_MAXIMIZE for ShowWindow function


              [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
              richie@entrian. com

              Comment

              Working...