Jump to content

GUI can't maximized when running AutoIt script background


Recommended Posts

Hello All,

I have a AutoIt script that run at background, and I want to maximized the GUI before it go the next step.

I had use WinGetState, but seem like WinGetState did not working and will make some tab can’t be click because the GUI is not maximized. However, if I make it run as usual (mean not running in the background), the GUI can be maximized.

#include <GuiTab.au3>
#include <StringConstants.au3>

ShellExecute("C:\test.exe")

If Not (WinWait("testing_name", 200)) Then ReportError("Fail to open app")

WinSetState("testing_name", "", @SW_MAXIMIZE)

If Not (WinActive("testing_name", "")) Then WinActivate("testing_name", "")

Is there any other way to make the GUI maximized when running at background?

Link to comment
Share on other sites

Try this:

Func Maximize($hWnd)
    If BitAnd(WinGetState($hWnd), 32) = 0 Then ; not maximized
        _SendMessage($hWnd, $WM_SYSCOMMAND, $SC_MAXIMIZE, 0)
    Else
        _SendMessage($hWnd, $WM_SYSCOMMAND, $SC_RESTORE, 0)
    EndIf
EndFunc

 

EDIT: calling:

Maximize(WinGetHandle("testing_name"))

 

Edited by Zedna
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...