guinness Posted March 29, 2011 Share Posted March 29, 2011 (edited) The following code works as intended. When the "Intercept" button is selected the GUI can't be resized/maximised. But with Windows 7 you can still drag the window to the left/right or top and it will resize accordingly, therefore suggesting $SC_SIZE isn't being "caught" with this "Windows 7 feature." I was therefore wondering did anyone have a workaround to to stop the GUI resizing when a user docks in Windows 7? Any help would be greatly appreciated. expandcollapse popup#include <WindowsConstants.au3> Global $iIntercept = 0 _Main() Func _Main() Local $iButton GUICreate("GUI", 200, 100, -1, -1, BitOR($WS_MAXIMIZEBOX, $WS_SIZEBOX)) $iButton = GUICtrlCreateButton("Intercept", 5, 5, 85, 25) GUICtrlSetResizing($iButton, 802) ; $GUI_DOCKALL GUIRegisterMsg(0x0112, "WM_SYSCOMMAND") GUISetState(@SW_SHOW) While 1 Switch GUIGetMsg() Case -3 Exit Case $iButton Switch GUICtrlRead($iButton) Case "Intercept" GUICtrlSetData($iButton, "Intercepted") $iIntercept = 1 Case Else GUICtrlSetData($iButton, "Intercept") $iIntercept = 0 EndSwitch EndSwitch WEnd EndFunc ;==>_Main Func WM_SYSCOMMAND($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg, $lParam Local Const $SC_MAXIMIZE = 0xF030 Local Const $SC_SIZE = 0xF000 Switch BitAND($wParam, 0xFFF0) Case $SC_MAXIMIZE, $SC_SIZE If $iIntercept = 1 Then Return -1 EndIf EndSwitch Return "GUI_RUNDEFMSG" EndFunc ;==>WM_SYSCOMMAND Edited March 29, 2011 by guinness UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 Link to comment Share on other sites More sharing options...
KaFu Posted March 30, 2011 Share Posted March 30, 2011 Currently working on a XP machine , but how about this? expandcollapse popup#include <WindowsConstants.au3> Global $iIntercept = 0, $aWinPos _Main() Func _Main() Local $iButton GUICreate("GUI", 200, 100, -1, -1, BitOR($WS_MAXIMIZEBOX, $WS_SIZEBOX)) $iButton = GUICtrlCreateButton("Intercept", 5, 5, 85, 25) GUICtrlSetResizing($iButton, 802) ; $GUI_DOCKALL GUIRegisterMsg(0x0024, "WM_GETMINMAXINFO") GUIRegisterMsg(0x0112, "WM_SYSCOMMAND") GUISetState(@SW_SHOW) While 1 Switch GUIGetMsg() Case -3 Exit Case $iButton Switch GUICtrlRead($iButton) Case "Intercept" GUICtrlSetData($iButton, "Intercepted") $iIntercept = 1 Case Else GUICtrlSetData($iButton, "Intercept") $iIntercept = 0 EndSwitch EndSwitch WEnd EndFunc ;==>_Main Func WM_GETMINMAXINFO($hWnd, $MsgID, $wParam, $lParam) #forceref $MsgID, $wParam If $iIntercept Then $structmaxinfo = DllStructCreate("int;int;int;int;int;int;int;int;int;int", $lParam) DllStructSetData($structmaxinfo, 7, $aWinPos[2]); min X DllStructSetData($structmaxinfo, 8, $aWinPos[3]); min Y DllStructSetData($structmaxinfo, 9, $aWinPos[2]); max X DllStructSetData($structmaxinfo, 10, $aWinPos[3]); max Y Else $aWinPos = WinGetPos($hWnd, "") ;ConsoleWrite($aWinPos[2] & @TAB & $aWinPos[3] & @CRLF) EndIf Return "GUI_RUNDEFMSG" EndFunc ;==>WM_GETMINMAXINFO Func WM_SYSCOMMAND($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg, $lParam Local Const $SC_MAXIMIZE = 0xF030 Local Const $SC_SIZE = 0xF000 Switch BitAND($wParam, 0xFFF0) Case $SC_MAXIMIZE, $SC_SIZE If $iIntercept = 1 Then Return -1 EndIf EndSwitch Return "GUI_RUNDEFMSG" EndFunc ;==>WM_SYSCOMMAND OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2022-Nov-26) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Feb-16) HMW - Hide my Windows (2018-Sep-16) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2023-Jun-03) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16) Link to comment Share on other sites More sharing options...
guinness Posted March 30, 2011 Author Share Posted March 30, 2011 Wow! I always use WM_GETMINMAXINFO to set the minimum GUI height/width, but really didn't think about using it here Thanks ever so much KaFu, you showed me how to think outside the box UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 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