Knight 2 Posted September 21, 2011 I have a third party application that launches a window with a title bar but no exit or minimize buttons on it. Is it possible to add these buttons, specifically minimize, to that window with an AutoIt script? Share this post Link to post Share on other sites
czardas 1,269 Posted September 21, 2011 (edited) You can't add buttons to an external program GUI, however you could possibly make a separate tool window with buttons to minimize and maximize the GUI. It may even be possible to somehow float an image over the top right hand corner of the original window and click on that. That's a bit too complicated for me though. Edited September 21, 2011 by czardas operator64 ArrayWorkshop Share this post Link to post Share on other sites
monoscout999 10 Posted September 21, 2011 This. #include <WindowsConstants.au3> #include <WinAPI.au3> #include <Constants.au3> Global $Check = False $hGui = GuiCreate("Change/UnChange WS_MAXIMIZEBOX",250,30) $iAction = GuiCtrlCreateButton("Remove WS_MAXIMIZEBOX to Calc",0,0,250,30) GuiSetState() Run("Calc.exe") WinWait("[CLASS:CalcFrame]") $hWinHandle = WingetHandle("[CLASS:CalcFrame]") $dwStyle = _WinApi_getwindowlong($hWinHandle, $GWL_STYLE) While True $iMsg = GuiGetMsg() Switch $iMsg case - 3 WinClose($hWinHandle) Exit case $iAction If $check = false Then _WinAPI_SetWindowLong($hWinHandle, $GWL_STYLE, BitAND($dwStyle, $WS_MAXIMIZEBOX)) $check = Not $check Else _WinAPI_SetWindowLong($hWinHandle, $GWL_STYLE, $dwStyle) $check = Not $check EndIf EndSwitch WEnd The Bug is because the style changing is a little more complicated, but not too much. Share this post Link to post Share on other sites
Knight 2 Posted September 21, 2011 It just locks up the window. Share this post Link to post Share on other sites
czardas 1,269 Posted September 21, 2011 (edited) Try using the window information tool to get window info, and check out WinSetState in the help file. EditSome custom GUIs are not so easy to automate, and there is no guarantee that it will work. Edited September 21, 2011 by czardas operator64 ArrayWorkshop Share this post Link to post Share on other sites
Knight 2 Posted September 21, 2011 (edited) I found a solution that works using ANYGUI.au3. It is available on this forum. #include <AnyGUI.au3> #include <WindowsConstants.au3> $win = "Calculator" $hwnd = _GuiTarget($win) _TargetStyle("set", 1, $GUI_SS_DEFAULT_GUI, -1, $hwnd) _EndTarget() Edited September 21, 2011 by Knight Share this post Link to post Share on other sites