JonatanRaven Posted December 4, 2011 Posted December 4, 2011 (edited) Dabbling a bit with GUI at the moment and trying to change the looks of the windows I create but I can't seem to get it to work the way I want it to.I can get it to look the way I want it to but not behave the way I want to.Basically, I want that frame but still be able to move the window around.expandcollapse popup#include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> ;Opt("GUIOnEventMode", 1) ;0=disabled, 1=OnEvent mode enabled Opt("GUICloseOnESC", 1) ;1=ESC closes, 0=ESC won't close TestGui1() TestGui2() TestGui3() TestGui4() ;TestGui5() Func TestGui1 () $MainWindow = GUICreate("Test GUI 1", 250, 140, @DesktopWidth -270, @DesktopHeight -200, BitXOR($WS_THICKFRAME,$WS_POPUP)) ;GUISetOnEvent($GUI_EVENT_CLOSE, "Close") $Frame = GUICtrlCreateGroup("Test GUI 1", 10, 0, 230, 100) GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif") $Button1 = GUICtrlCreateButton("&OK", 50, 105, 75, 25) $Cancel = GUICtrlCreateButton("&Cancel", 135, 105, 75, 25) GUICtrlSetOnEvent ($Cancel, "Close") GUISetState(@SW_SHOW) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE GUIDelete() ExitLoop EndSwitch WEnd EndFunc Func TestGui2 () $MainWindow = GUICreate("Test GUI 2", 250, 140, @DesktopWidth -270, @DesktopHeight -200, BitXOR($WS_POPUP,$WS_CAPTION)) ;GUISetOnEvent($GUI_EVENT_CLOSE, "Close") $Frame = GUICtrlCreateGroup("Test GUI 2", 10, 0, 230, 100) GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif") $Button1 = GUICtrlCreateButton("&OK", 50, 105, 75, 25) $Cancel = GUICtrlCreateButton("&Cancel", 135, 105, 75, 25) GUICtrlSetOnEvent ($Cancel, "Close") GUISetState(@SW_SHOW) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE GUIDelete() ExitLoop EndSwitch WEnd EndFunc Func TestGui3 () $MainWindow = GUICreate("Test GUI 3", 250, 140, @DesktopWidth -270, @DesktopHeight -200, BitXOR($WS_CAPTION,$WS_POPUPWINDOW)) ;GUISetOnEvent($GUI_EVENT_CLOSE, "Close") $Frame = GUICtrlCreateGroup("Test GUI 3", 10, 0, 230, 100) GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif") $Button1 = GUICtrlCreateButton("&OK", 50, 105, 75, 25) $Cancel = GUICtrlCreateButton("&Cancel", 135, 105, 75, 25) GUICtrlSetOnEvent ($Cancel, "Close") GUISetState(@SW_SHOW) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE GUIDelete() ExitLoop EndSwitch WEnd EndFunc Func TestGui4 () $MainWindow = GUICreate("Test GUI 4", 250, 140, @DesktopWidth -270, @DesktopHeight -200, BitXOR($DS_MODALFRAME,$WS_SYSMENU)) ;GUISetOnEvent($GUI_EVENT_CLOSE, "Close") $Frame = GUICtrlCreateGroup("Test GUI 4", 10, 0, 230, 100) GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif") $Button1 = GUICtrlCreateButton("&OK", 50, 105, 75, 25) $Cancel = GUICtrlCreateButton("&Cancel", 135, 105, 75, 25) GUICtrlSetOnEvent ($Cancel, "Close") GUISetState(@SW_SHOW) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE GUIDelete() ExitLoop EndSwitch WEnd EndFunc Func Close() Exit EndFuncBeen trying going through the help file and the forums for quite a while now.Any pointers are appreciated. Edited December 4, 2011 by JonatanRaven
Moderators Melba23 Posted December 4, 2011 Moderators Posted December 4, 2011 JonatanRaven,You need $WS_THICKFRAME to get the border, but then you need to prevent the resizing. And you need to fool Windows into letting you drag the GUI wherever the mouse is positioned. You code it like this:expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> ; Eet the size restrictions here Global $GUIMINWID = 500, $GUIMINHT = 500 Global $GUIMAXWID = 500, $GUIMAXHT = 500 $hGUI = GUICreate("Test", 500, 500, -1, -1, BitOR($WS_POPUP, $WS_THICKFRAME)) GUISetState() GUIRegisterMsg($WM_NCHITTEST, "_MY_NCHITTEST") GUIRegisterMsg($WM_GETMINMAXINFO, "WM_GETMINMAXINFO") While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func _MY_NCHITTEST($hWnd, $uMsg, $wParam, $lParam) ; If it is our GUI If $hWnd = $hGUI Then ; Check if mouse is over the GUI Local $aPos = WinGetPos($hWnd) If Abs(BitAND(BitShift($lParam, 16), 0xFFFF) - $aPos[1]) < 500 Then ; Fool Windows into thinking it is the title bar so it drags the GUI Return $HTCAPTION EndIf EndIf Return $GUI_RUNDEFMSG EndFunc ;==>_MY_NCHITTEST Func WM_GETMINMAXINFO($hWnd, $Msg, $wParam, $lParam) ; Set the values regardless of the resizing $tagMaxinfo = DllStructCreate("int;int;int;int;int;int;int;int;int;int", $lParam) DllStructSetData($tagMaxinfo, 7, $GUIMINWID) ; min X DllStructSetData($tagMaxinfo, 8, $GUIMINHT) ; min Y DllStructSetData($tagMaxinfo, 9, $GUIMAXWID) ; max X DllStructSetData($tagMaxinfo, 10, $GUIMAXHT) ; max Y Return 0 EndFunc ;==>WM_GETMINMAXINFOI think it is commented sufficiently, but please ask if anything is unclear. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
JonatanRaven Posted December 4, 2011 Author Posted December 4, 2011 Ouch, a bit over my current level I think but thanks for the help. I'll dabble some more ^^
Moderators Melba23 Posted December 4, 2011 Moderators Posted December 4, 2011 JonatanRaven,Try the GUIRegisterMsg tutorial in the Wiki. Please feel free to ask any questions you might have - that is why we are here after all! M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
JonatanRaven Posted December 4, 2011 Author Posted December 4, 2011 Well, as far as I could tell, it didn't really accomplish what I wanted to be honest. From the looks of it, it's easier to wrap my head around some other way of accomplishing what I want. Found this:
Moderators Melba23 Posted December 4, 2011 Moderators Posted December 4, 2011 JonatanRaven,it didn't really accomplish what I wanted to be honestI though that it was just what you wanted: I want that frame but still be able to move the window aroundThe topic you link to shows another way of moving a pop-up window. If you want to see all the possibilties then I recommend the Moving and Resizing PopUp GUIs tutorial in the Wiki. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
JonatanRaven Posted December 4, 2011 Author Posted December 4, 2011 Well, it does do exactly what I requested. But it flickers in size when you move it. Any way to work around that? I can't see why it does that..
Moderators Melba23 Posted December 4, 2011 Moderators Posted December 4, 2011 JonatanRaven It does not flicker when I move it so I cannot offer any ideas how to stop it. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
JonatanRaven Posted December 4, 2011 Author Posted December 4, 2011 (edited) Hmm, ok, where did I go wrong then? When the window is created it looks just like I want it to look but when I click the window to drag it it suddenly changes size. Only slightly but still. #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> ;SIZE RESTRICTIONS HAD TO BE LARGER THAN THE ACTUAL WINDOW FOR IT TO NOT FLICKER Global $GUIMINWID = 265, $GUIMINHT = 155 Global $GUIMAXWID = 265, $GUIMAXHT = 155 $hGUI = GUICreate("Test", 250, 140, @DesktopWidth/2 -125, @DesktopHeight/2 -100, BitOR($WS_POPUP, $WS_THICKFRAME)) GUISetState() GUIRegisterMsg($WM_NCHITTEST, "_MY_NCHITTEST") GUIRegisterMsg($WM_GETMINMAXINFO, "WM_GETMINMAXINFO") While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func _MY_NCHITTEST($hWnd, $uMsg, $wParam, $lParam) ; If it is our GUI If $hWnd = $hGUI Then ; Check if mouse is over the GUI Local $aPos = WinGetPos($hWnd) If Abs(BitAND(BitShift($lParam, 16), 0xFFFF) - $aPos[1]) < 500 Then ; Fool Windows into thinking it is the title bar so it drags the GUI Return $HTCAPTION EndIf EndIf Return $GUI_RUNDEFMSG EndFunc ;==>_MY_NCHITTEST Func WM_GETMINMAXINFO($hWnd, $Msg, $wParam, $lParam) ; Set the values regardless of the resizing $tagMaxinfo = DllStructCreate("int;int;int;int;int;int;int;int;int;int", $lParam) DllStructSetData($tagMaxinfo, 7, $GUIMINWID) ; min X DllStructSetData($tagMaxinfo, 8, $GUIMINHT) ; min Y DllStructSetData($tagMaxinfo, 9, $GUIMAXWID) ; max X DllStructSetData($tagMaxinfo, 10, $GUIMAXHT) ; max Y Return 0 EndFunc ;==>WM_GETMINMAXINFO Edit: I found a solution, the size restrictions had to be larger than the actual window otherwise the window would resize when I dragged the window. Edited December 4, 2011 by JonatanRaven
Moderators Melba23 Posted December 4, 2011 Moderators Posted December 4, 2011 JonatanRaven,That is because the parameters in GUICreate define the client area - the area inside the borders. The MINMAXINFO values define the whole GUI - including the borders. I get farly thin borders when I use $WS_THICKFRAME so the effect is minimal - you obviously have a differnt theme and so have thicker borders. You could use _WinAPI_GetSystemMetrics to get the actual value for the border size and then add it to the MINMAXINFO values if you wanted to be really fussy. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
Zedna Posted December 4, 2011 Posted December 4, 2011 (edited) JonatanRaven,That is because the parameters in GUICreate define the client area - the area inside the borders. The MINMAXINFO values define the whole GUI - including the borders.Here is the way how to simply get desired size of window by WinGetPos() and use it in minmaxinfo message Edited December 4, 2011 by Zedna Resources UDF ResourcesEx UDF AutoIt Forum Search
Moderators Melba23 Posted December 4, 2011 Moderators Posted December 4, 2011 Zedna, Clever! M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
BrewManNH Posted December 4, 2011 Posted December 4, 2011 Instead of grabbing the MinMax windows messages, you can always use GUIRegisterMsg with the $WM_SYSCOMMAND windows messages, and prevent Windows from seeing them at all so the window won't ever be able to get resized. No flickering and no need to figure out the size of the GUI. See the code I posted in In there is an example showing the messages that are sent when you click on various parts of the GUI. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator
JonatanRaven Posted December 4, 2011 Author Posted December 4, 2011 (edited) Well, after some trial and error I combined those codes you posted/linked to this: expandcollapse popup#Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Icon=D:DocumentsLOTROicon.ico #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <WinAPI.au3> Opt("GUIOnEventMode", 0) ;0=disabled, 1=OnEvent mode enabled Opt("GUICloseOnESC", 1) ;1=ESC closes, 0=ESC won't close Global $size, $width, $height $gui = GUICreate("Test GUI",250,140,@DesktopWidth-270,@DesktopHeight-200,BitOR($WS_POPUP, $WS_THICKFRAME)) $size = WinGetPos($gui) $width = $size[2] ; width of window (GUICreate is ClientSize) $height = $size[3] ; height of window (GUICreate is ClientSize) GUISetState (@SW_SHOW) GUIRegisterMsg($WM_GETMINMAXINFO, "MY_WM_GETMINMAXINFO") GUIRegisterMsg($WM_NCHITTEST, "_MY_NCHITTEST") While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop Wend Func _MY_NCHITTEST($hWnd, $uMsg, $wParam, $lParam) ; If it is our GUI If $hWnd = $gui Then ; Check if mouse is over the GUI Local $aPos = WinGetPos($hWnd) If Abs(BitAND(BitShift($lParam, 16), 0xFFFF) - $aPos[1]) < 500 Then ; Fool Windows into thinking it is the title bar so it drags the GUI Return $HTCAPTION EndIf EndIf Return $GUI_RUNDEFMSG EndFunc ;==>_MY_NCHITTEST Func MY_WM_GETMINMAXINFO($hWnd, $Msg, $wParam, $lParam) $minmaxinfo = DllStructCreate("int;int;int;int;int;int;int;int;int;int",$lParam) DllStructSetData($minmaxinfo,7,$width) ; min X DllStructSetData($minmaxinfo,8,$height) ; min Y DllStructSetData($minmaxinfo,9,$width) ; max X DllStructSetData($minmaxinfo,10,$height) ; max Y Return 0 EndFunc Not sure if I included anything that isn't really needed but at least it works the way I want it to. I'll have to check up that link BrewManNH posted as well, see if I can learn something new. Thx a lot for the help guys. Edited December 4, 2011 by JonatanRaven
Moderators Melba23 Posted December 4, 2011 Moderators Posted December 4, 2011 JonatanRaven, BrewManNH's idea works like this: expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> ; Eet the size restrictions here Global $GUIMINWID = 500, $GUIMINHT = 500 Global $GUIMAXWID = 500, $GUIMAXHT = 500 $hGUI = GUICreate("Test", 500, 500, -1, -1, BitOR($WS_POPUP, $WS_THICKFRAME)) GUISetState() GUIRegisterMsg($WM_NCHITTEST, "_MY_NCHITTEST") GUIRegisterMsg($WM_SYSCOMMAND, "WM_SYSCOMMAND") While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func _MY_NCHITTEST($hWnd, $uMsg, $wParam, $lParam) ; If it is our GUI If $hWnd = $hGUI Then ; Check if mouse is over the GUI Local $aPos = WinGetPos($hWnd) If Abs(BitAND(BitShift($lParam, 16), 0xFFFF) - $aPos[1]) < 500 Then ; Fool Windows into thinking it is the title bar so it drags the GUI Return $HTCAPTION EndIf EndIf Return $GUI_RUNDEFMSG EndFunc ;==>_MY_NCHITTEST Func WM_SYSCOMMAND($hWnd, $Msg, $wParam, $lParam) ; If it is our GUI and we are trying to resize it If $hWnd = $hGUI And $wParam = 0xF000 Then ; $SC_SIZE ; Do not let it happen Return 0 EndIf EndFunc ;==>WM_SYSCOMMAND I hope that solves the problem. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
JonatanRaven Posted December 4, 2011 Author Posted December 4, 2011 (edited) The problem is solved alright, thank you. So, if I understand the difference between the two methods, the $WM_SYSCOMMAND version doesn't interrupt loops while the $WM_GETMINMAXINFO version could? Are there any other differences between them? Are both versions dependent on the users current skin? I'm still very new at this and only scripting because I find it interesting and entertainging. Learning as I go. Edited December 4, 2011 by JonatanRaven
Moderators Melba23 Posted December 4, 2011 Moderators Posted December 4, 2011 JonatanRaven,The 2 methods differ in the manner we intercept the Windows messages. Did you read the GUIRegisterMsg tutorial and understand how Windows uses messages to pass information around? In simple terms, the SYSCOMMAND version of the script prevents the SIZE message from being transmitted - the MINMAXINFO version limits the values that the resizing can take when a SIZE message is received. Then end result is the same - the GUI does not change size. Does that make sense? M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
JonatanRaven Posted December 4, 2011 Author Posted December 4, 2011 Yes, admittedly I didn't read the GUIRegisterMsg tutorial very carefully, I understand the concept in general but a lot of what is being said is still gibberish. lol Syscommand prevents the size message from even being sent while the minmaxinfo still prompts for the info but restricts the values. So the syscommand variant would be preferable as it won't interrupt any long loops. That's how I read it all (without really getting into all the details yet). Anyways, big thanks. Now I'll just have to find a use for my GUI as well.
JonatanRaven Posted December 6, 2011 Author Posted December 6, 2011 JonatanRaven, BrewManNH's idea works like this: expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> ; Eet the size restrictions here Global $GUIMINWID = 500, $GUIMINHT = 500 Global $GUIMAXWID = 500, $GUIMAXHT = 500 $hGUI = GUICreate("Test", 500, 500, -1, -1, BitOR($WS_POPUP, $WS_THICKFRAME)) GUISetState() GUIRegisterMsg($WM_NCHITTEST, "_MY_NCHITTEST") GUIRegisterMsg($WM_SYSCOMMAND, "WM_SYSCOMMAND") While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func _MY_NCHITTEST($hWnd, $uMsg, $wParam, $lParam) ; If it is our GUI If $hWnd = $hGUI Then ; Check if mouse is over the GUI Local $aPos = WinGetPos($hWnd) If Abs(BitAND(BitShift($lParam, 16), 0xFFFF) - $aPos[1]) < 500 Then ; Fool Windows into thinking it is the title bar so it drags the GUI Return $HTCAPTION EndIf EndIf Return $GUI_RUNDEFMSG EndFunc ;==>_MY_NCHITTEST Func WM_SYSCOMMAND($hWnd, $Msg, $wParam, $lParam) ; If it is our GUI and we are trying to resize it If $hWnd = $hGUI And $wParam = 0xF000 Then ; $SC_SIZE ; Do not let it happen Return 0 EndIf EndFunc ;==>WM_SYSCOMMAND I hope that solves the problem. M23 Ok, back on this one for a bit, there's something that's confusing me a bit here. What does the following two lines actually do? Global $GUIMINWID = 500, $GUIMINHT = 500 Global $GUIMAXWID = 500, $GUIMAXHT = 500 If I comment them out of my script, nothing seems to change. Are they not needed or why are they included in the example?
Moderators Melba23 Posted December 6, 2011 Moderators Posted December 6, 2011 JonatanRaven,Are they not neededCorrect - I forgot to take them out of the example when I modified it. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
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