sbonacina Posted June 23, 2009 Share Posted June 23, 2009 (edited) Dear all, I went through the forum and didn't found yet any topic concerning my need. My company users use a commercial application that I want to be run by an autoit script, because of some display setting that need to be done before running the app. So I wrote a script that runs this application, this way: Run ("cmd /C set USER_HOME="& $UserHome &"& .\prog.exe ) WInWaitClose ( "Program Name" ) I would like to lock the size of the application window, so I tried the following: Opt("GUIResizeMode", 768); no resize Opt("GUIEventOptions",0) without any success. And also this: $spHandle=WinGetHandle ( "Program Name") GUICtrlSetResizing($spHandle, $GUI_DOCKSIZE) But, as far as I understood, all of theese apply to created GUI objects, not to external windows. Any idea on how to do that? Thanks a lot for your help Best regards STefano Edited June 23, 2009 by sbonacina Link to comment Share on other sites More sharing options...
picea892 Posted June 23, 2009 Share Posted June 23, 2009 I know there must be a better way, but I will give you my 2 cents. Query if the mouse cursor is a size symbol and the wintitle is the application. If it is, block mouse input.Block mouse input using thishttp://www.autoitscript.com/forum/index.ph...showtopic=82650Global $on=0 while 1 for $i= 8 to 13 if $i = MouseGetCursor() and WinGetTitle() = "applicationname" and $on=0 then ;call Block mouse input here $on=1 Next for $i= 1 to 7 if $i = MouseGetCursor() and $on=1 then ; Remove Block from mouse $on=0 Next for $i= 14 to 15 if $i = MouseGetCursor() and $on=1 then $on=0 ; Remove Block from mouse Next sleep(50) WEnd Link to comment Share on other sites More sharing options...
spudw2k Posted June 23, 2009 Share Posted June 23, 2009 (edited) This code will remove the Sizebox style from a window. #Include <WinAPI.au3> Const $GWL_STYLE = -16 Const $WS_SIZEBOX = 262144 $hWnd = WinGetHandle("Program Name") $style = _WinAPI_GetWindowLong($hWnd, $GWL_STYLE) If BitXOR($style,$WS_SIZEBOX) <> BitOr($style,BitXOR($style,$WS_SIZEBOX)) Then _WinAPI_SetWindowLong($hWnd,$GWL_STYLE,BitXOR($style,$WS_SIZEBOX)) Edited June 23, 2009 by spudw2k Spoiler Things I've Made: Always On Top Tool ◊ AU History ◊ Deck of Cards ◊ HideIt ◊ ICU ◊ Icon Freezer ◊ Ipod Ejector ◊ Junos Configuration Explorer ◊ Link Downloader ◊ MD5 Folder Enumerator ◊ PassGen ◊ Ping Tool ◊ Quick NIC ◊ Read OCR ◊ RemoteIT ◊ SchTasksGui ◊ SpyCam ◊ System Scan Report Tool ◊ System UpTime ◊ Transparency Machine ◊ VMWare ESX Builder Misc Code Snippets: ADODB Example ◊ CheckHover ◊ Detect SafeMode ◊ DynEnumArray ◊ GetNetStatData ◊ HashArray ◊ IsBetweenDates ◊ Local Admins ◊ Make Choice ◊ Recursive File List ◊ Remove Sizebox Style ◊ Retrieve PNPDeviceID ◊ Retrieve SysListView32 Contents ◊ Set IE Homepage ◊ Tickle Expired Password ◊ Transpose Array Projects: Drive Space Usage GUI ◊ LEDkIT ◊ Plasma_kIt ◊ Scan Engine Builder ◊ SpeeDBurner ◊ SubnetCalc Cool Stuff: AutoItObject UDF ◊ Extract Icon From Proc ◊ GuiCtrlFontRotate ◊ Hex Edit Funcs ◊ Run binary ◊ Service_UDF Link to comment Share on other sites More sharing options...
sbonacina Posted June 24, 2009 Author Share Posted June 24, 2009 (edited) Many thanks, spudw2k. That worked fine. Your hint paved my way to better understand the Window handling. I went a little bit further and I disabled also the Maximize Box. To whom it might be of interest, here's the code: #Include <WinAPI.au3>; to call Windows api specific functions #include <WindowsConstants.au3>; to include Windows specific constants, such as the Windows Style Values $newhWnd = WinGetHandle("Program Name") $style = _WinAPI_GetWindowLong($newhWnd, $GWL_STYLE) If BitXOR($style,$WS_SIZEBOX,$WS_MAXIMIZEBOX) <> BitOr($style,BitXOR($style,$WS_SIZEBOX,$WS_MAXIMIZEBOX)) Then _WinAPI_SetWindowLong($newhWnd,$GWL_STYLE,BitXOR($style,$WS_SIZEBOX,$WS_MAXIMIZEBOX)) Edited June 24, 2009 by sbonacina Link to comment Share on other sites More sharing options...
martin Posted June 24, 2009 Share Posted June 24, 2009 Many thanks, spudw2k. That worked fine. Your hint paved my way to better understand the Window handling. I went a little bit further and I disabled also the Maximize Box. To whom it might be of interest, here's the code: #Include <WinAPI.au3>; to call Windows api specific functions #include <WindowsConstants.au3>; to include Windows specific constants, such as the Windows Style Values $newhWnd = WinGetHandle("Sun xVM VirtualBox") $style = _WinAPI_GetWindowLong($newhWnd, $GWL_STYLE) If BitXOR($style,$WS_SIZEBOX,$WS_MAXIMIZEBOX) <> BitOr($style,BitXOR($style,$WS_SIZEBOX,$WS_MAXIMIZEBOX)) Then _WinAPI_SetWindowLong($newhWnd,$GWL_STYLE,BitXOR($style,$WS_SIZEBOX,$WS_MAXIMIZEBOX)) The BitXOR logic looks very complicated. I think this would do the same If BitAnd($style,BitOr($WS_SIZEBOX,$WS_MAXIMIZEBOX)) Then _WinAPI_SetWindowLong(... Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
spudw2k Posted June 24, 2009 Share Posted June 24, 2009 The BitXOR logic looks very complicated. I think this would do the same If BitAnd($style,BitOr($WS_SIZEBOX,$WS_MAXIMIZEBOX)) Then _WinAPI_SetWindowLong(...Agreed, your method is much more efficient. Spoiler Things I've Made: Always On Top Tool ◊ AU History ◊ Deck of Cards ◊ HideIt ◊ ICU ◊ Icon Freezer ◊ Ipod Ejector ◊ Junos Configuration Explorer ◊ Link Downloader ◊ MD5 Folder Enumerator ◊ PassGen ◊ Ping Tool ◊ Quick NIC ◊ Read OCR ◊ RemoteIT ◊ SchTasksGui ◊ SpyCam ◊ System Scan Report Tool ◊ System UpTime ◊ Transparency Machine ◊ VMWare ESX Builder Misc Code Snippets: ADODB Example ◊ CheckHover ◊ Detect SafeMode ◊ DynEnumArray ◊ GetNetStatData ◊ HashArray ◊ IsBetweenDates ◊ Local Admins ◊ Make Choice ◊ Recursive File List ◊ Remove Sizebox Style ◊ Retrieve PNPDeviceID ◊ Retrieve SysListView32 Contents ◊ Set IE Homepage ◊ Tickle Expired Password ◊ Transpose Array Projects: Drive Space Usage GUI ◊ LEDkIT ◊ Plasma_kIt ◊ Scan Engine Builder ◊ SpeeDBurner ◊ SubnetCalc Cool Stuff: AutoItObject UDF ◊ Extract Icon From Proc ◊ GuiCtrlFontRotate ◊ Hex Edit Funcs ◊ Run binary ◊ Service_UDF Link to comment Share on other sites More sharing options...
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