Knight Posted September 21, 2011 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?
czardas Posted September 21, 2011 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
monoscout999 Posted September 21, 2011 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.
czardas Posted September 21, 2011 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
Knight Posted September 21, 2011 Author 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
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