mikeDoc Posted June 14, 2022 Posted June 14, 2022 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?
mikeDoc Posted June 14, 2022 Author Posted June 14, 2022 Typo in the description, It should be WinSetState, not WinGetState
OJBakker Posted June 14, 2022 Posted June 14, 2022 Have you tried: Local $hTest = ShellExecute("C:\test.exe", "", "C:\", Default, @SW_MAXIMIZE)
mikeDoc Posted June 16, 2022 Author Posted June 16, 2022 On 6/14/2022 at 4:10 PM, OJBakker said: Have you tried: Local $hTest = ShellExecute("C:\test.exe", "", "C:\", Default, @SW_MAXIMIZE) Yes, but it get same result
Zedna Posted June 16, 2022 Posted June 16, 2022 (edited) 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 June 16, 2022 by Zedna Resources UDF ResourcesEx UDF AutoIt Forum Search
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now