xtrim 0 Posted January 24, 2011 Hi, How do I lock an external(Other program) windows state? I don't want the user to be able to resize the window. is it possible? Is it possible also to monitor the window state? tnx Xtrim Share this post Link to post Share on other sites
Andreik 66 Posted January 25, 2011 @SW_LOCK is a macro that allow you to lock a window (lock = prevent window paint in this case). To make a window unresizable depends by window style. For example a window with style $WS_SIZEBOX is unresizable. Try this little example after you open Notepad. #include <WinAPI.au3> Const $GWL_STYLE = -16 Const $WS_SIZEBOX = 262144 $HWND = WinGetHandle("Untitled - Notepad") $STYLE = _WinAPI_GetWindowLong($HWND,$GWL_STYLE) If BitAND($STYLE,$WS_SIZEBOX) = $WS_SIZEBOX Then _WinAPI_SetWindowLong($HWND,$GWL_STYLE,BitXOR($STYLE,$WS_SIZEBOX)) EndIf Before run this script Notepad window should be resizable. After you run the script Notepad window will not have anymore $WS_SIZEBOX style. When the words fail... music speaks Share this post Link to post Share on other sites
JoHanatCent 13 Posted January 25, 2011 Is it possible also to monitor the window state? From the help window: ; Check if a new notepad window is minimized $state = WinGetState("[CLASS:Notepad]", "") ; Is the "minimized" value set? If BitAnd($state, 16) Then MsgBox(0, "Example", "Window is minimized") EndIf or $sAutoItPath = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\AutoIt v3\AutoIt", "InstallDir") Run(@WindowsDir & "\HH.exe " & $sAutoItPath & "\AutoIt3.chm::/html/functions/WinGetState.htm", "", @SW_MAXIMIZE) Share this post Link to post Share on other sites