xtrim Posted January 24, 2011 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
Andreik Posted January 25, 2011 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.
JoHanatCent Posted January 25, 2011 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)
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