Jump to content

Search the Community

Showing results for tags 'wm_getminmaxinfo'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • General
    • Announcements and Site News
    • Administration
  • AutoIt v3
    • AutoIt Help and Support
    • AutoIt Technical Discussion
    • AutoIt Example Scripts
  • Scripting and Development
    • Developer General Discussion
    • Language Specific Discussion
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • AutoIt Team
    • Beta
    • MVP
  • AutoIt
    • Automation
    • Databases and web connections
    • Data compression
    • Encryption and hash
    • Games
    • GUI Additions
    • Hardware
    • Information gathering
    • Internet protocol suite
    • Maths
    • Media
    • PDF
    • Security
    • Social Media and other Website API
    • Windows
  • Scripting and Development
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Member Title


Location


WWW


Interests

Found 3 results

  1. #AutoIt3Wrapper_AU3Check_Parameters=-q -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7 #include "GuiChildTabUDF.au3" Global $__iFlashWindowEx = 0 ; ..see _WM_SETCURSOR() tabGUI_OPTs("RandomColor", 1) ; ..to add coloring to the GUIs, for debug. ( Default is 0 ) tabGUI_OPTs("SetCtrlDbgCreateWidth", 1) ; tells the UDF to leave some space for the debug buttons ( see tabGUI_CtrlDbgCreate() ). ( Default is 0 ) tabGUI_Example() Func tabGUI_Example() ; tabGUI_Create() has the same parameters as GUICreate() ; ..just skip the styles, as those are handled by the function. tabGUI_Create("Parent/Children Example") ; the first GUI will have to be the parent tabGUI_CtrlDbgCreate("Show GUI array") ; All these are tabGUI_CtrlDbgCreate("Show OPT array") ; for debug and tabGUI_CtrlDbgCreate("Swap GUIs/LABELs") ; are not needed tabGUI_CtrlDbgCreate("Can Drag child") ; to use the UDF tabGUI_CtrlDbgCreate("Self CPU usage") ; These are called after a GUI is present. ; search for "SetResizing:" to understand the TITLE modification ( used for tabGUI_DockStr2Int() ) tabGUI_Create("SetResizing:LBWH;1", 400, 400, 20, 20) ; all other GUI will be child addSomeControls() tabGUI_Create("2", 400, 400, 60, 60) addSomeControls() ; multiple child in child example ; ..skip the width and heigth, to have the function calculate the values. tabGUI_Create("3", Default, Default, 200, 230) tabGUI_Create("4", Default, Default, 20, 20, Default, Default, $__a_tabGUI[@extended][$eGui_HWindowSelf]) tabGUI_Create("5", Default, Default, 20, 20, Default, Default, $__a_tabGUI[@extended][$eGui_HWindowSelf]) Local $hGUI = tabGUI_Create("6", Default, Default, 20, 20, Default, Default, $__a_tabGUI[@extended][$eGui_HWindowSelf]) ; ..the function returns the windows handle, just like GUICreate() would. ConsoleWrite('$hGUI = ' & $hGUI & ' - @extended: ' & @extended & ' ( @extended returns the GUI index in the array )' & @CRLF) addSomeControls() GUISetState(@SW_SHOW, $__a_tabGUI[1][$eGui_HWindowSelf]) ; Time to show the parent GUI GUISwitch($__a_tabGUI[1][$eGui_HWindowSelf]) ; and get focus. GUIRegisterMsg($WM_SETCURSOR, "_WM_SETCURSOR") ; for _WinAPI_FlashWindowEx() While 1 Sleep(1000000) ; ..no need to sleep() a minimum in this loop, as is just there to not close the script in this example. WEnd EndFunc ;==>tabGUI_Example Func addSomeControls() ; ..some controls to add to the example GUICtrlCreateButton("bttn 1", 10, 10, 55, 25) GUICtrlSetOnEvent(-1, "addSomeEvents") GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT) GUICtrlCreateButton("bttn 2", 10, 35, 55, 25) GUICtrlSetOnEvent(-1, "addSomeEvents") GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT) GUICtrlCreateTab(10, 70, 380, 320) GUICtrlSetOnEvent(-1, "addSomeEvents") GUICtrlSetResizing(-1, $GUI_DOCKRIGHT + $GUI_DOCKTOP + $GUI_DOCKLEFT + $GUI_DOCKBOTTOM) GUICtrlCreateTabItem("TabSheet1") GUICtrlCreateTabItem("TabSheet2") GUICtrlCreateTabItem("") EndFunc ;==>addSomeControls Func addSomeEvents() ;~ $__iFlashWindowEx = TimerInit() MsgBox(0, "your ""OnEvent""", "@GUI_CtrlId = " & @GUI_CtrlId, 1, $__a_tabGUI[1][$eGui_HWindowSelf]) ;~ $__iFlashWindowEx = 0 EndFunc ;==>addSomeEvents Func _WM_SETCURSOR($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg, $wParam ; FYI: this is meant to flash the Parent GUI of a MsgBox(), ; so the MsgBox() needs a Parent GUI declaration. ; If the 0xFFFE guess don't work, or just wanna save CPU cycles, then you'll need a trigger. ; Maybe something like this below. ;~ If $__iFlashWindowEx = 0 Then Return $GUI_RUNDEFMSG ;~ If TimerDiff($__iFlashWindowEx) < 100 Then Return $GUI_RUNDEFMSG Local Static $hTimerTooSoon = TimerInit(), $hTimerWaitAMoment = TimerInit() If _WinAPI_LoWord($lParam) <> 0xFFFE Then $hTimerWaitAMoment = TimerInit() Return $GUI_RUNDEFMSG EndIf If TimerDiff($hTimerWaitAMoment) < 200 Then Return $GUI_RUNDEFMSG If TimerDiff($hTimerTooSoon) < 500 Then Return $GUI_RUNDEFMSG Local $mouse = _WinAPI_HiWord($lParam) ; https://docs.microsoft.com/en-us/windows/win32/menurc/wm-setcursor ; https://docs.microsoft.com/en-us/windows/win32/inputdev/wm-mousemove Local Const $MK_LBUTTON = 0x0001 Local Const $MK_RBUTTON = 0x0002 Local Const $MK_MBUTTON = 0x0010 Local Const $MK_XBUTTON1 = 0x0020 Local Const $MK_XBUTTON2 = 0x0040 ;~ If BitAND($mouse, $MK_LBUTTON) Then ConsoleWrite('- clicked MK_LBUTTON' & @CRLF) ;~ If BitAND($mouse, $MK_RBUTTON) Then ConsoleWrite('- clicked MK_RBUTTON' & @CRLF) ;~ If BitAND($mouse, $MK_MBUTTON) Then ConsoleWrite('- clicked MK_MBUTTON' & @CRLF) ;~ If BitAND($mouse, $MK_XBUTTON1) Then ConsoleWrite('- clicked MK_XBUTTON1' & @CRLF) ;~ If BitAND($mouse, $MK_XBUTTON2) Then ConsoleWrite('- clicked MK_XBUTTON2' & @CRLF) If BitAND($mouse, $MK_LBUTTON) Or BitAND($mouse, $MK_RBUTTON) Or _ BitAND($mouse, $MK_MBUTTON) Or BitAND($mouse, $MK_XBUTTON1) Or _ BitAND($mouse, $MK_XBUTTON2) Then $hTimerTooSoon = TimerInit() _WinAPI_MessageBeep(4) ; mimic what windows does by default when _WinAPI_FlashWindowEx($hWnd, 3, 6, 50) ; clicking the title. _WinAPI_FlashWindowEx(WinGetHandle("[CLASS:#32770;]"), 3, 6, 50) ; ..this works on the MsgBox() because is the "on top" in the Z order ; as the code just created it ( and it *is* on top ). EndIf Return $GUI_RUNDEFMSG EndFunc ;==>_WM_SETCURSOR This is a post of example(s). The code started due to the observation that controls don't look the same when in a tab control. Digging thru the forum I found chunks of code so I smash them together to solve my issues. The "UDF" is more of an useful include than an UDF, but it shows how to use Child GUIs instead of a TAB control. In each child GUI you can have a GUICtrlCreateTab(). ( something that I did not realize until I browse the Wiki ) Working on the code I found myself having to GUIRegisterMsg(). Then why not register more and do more. Took me about a month to discover how to put it together. Then I'm like "this would make a good example". So try it out, use what you need ( or as is ). Hopefully it'll save you the learning curve. The code is in the downloads section. ( I'm a copy and paste kind of coder, so racking my brain is not my forte. But at times, is what it takes to get working code ) PS: if you find a better way to do something or a gross misinterpretation in the code, do share. ( so I can copy and paste )
  2. Hi, There's an external window that I would like to set a minimum window size on. I've seen this is possible for internal GUI windows using GUIRegisterMsg and WM_GETMINMAXINFO. So, is it possible to do the same thing but on an external window? Thanks, Fidel
  3. At some point we've all seen the example for WM_GETMINMAXINFO floating around the forum, in regards to restricting the size of the GUI. I therefore decided to have a look at this and see if it could be rearranged to use structures and code already predefined in AutoIt and the UDFs. Sometimes users like to duplicate variables that may already exist in WindowsConstants.au3 or StructureConstants.au3 and it can cause problems down the line if the variable values change. You never know $GUI_EVENT_CLOSE (-3) might change to -99 one day, so this is why 'magic numbers' are bad to use in examples. So having read about WM_GETMINMAXINFO on MSDN, the structure that was required turned out to be tagMINMAXINFO, which was made up of 5 tagPOINT structures (long X;long Y;) strung together. So I created the following code below and will probably propose that the tagMINMAXINFO structure be added to the AutoIt UDFs. So my questions is: Does the structure look correct? Or should I use a different approach? Any feed back is much appreciated. #AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w- 4 -w 5 -w 6 -w 7 #include <GUIConstantsEx.au3> #include <Windowsconstants.au3> ; MINMAXINFO Struct >> http://msdn.microsoft.com/en-us/library/windows/desktop/ms632605(v=vs.85).aspx ; It uses a $tagPOINT structure which is long X; long Y; Global Const $tagMINMAXINFO = "struct; long ReservedX;long ReservedY;long MaxSizeX;long MaxSizeY;long MaxPositionX;long MaxPositionY;" & _ "long MinTrackSizeX;long MinTrackSizeY;long MaxTrackSizeX;long MaxTrackSizeY; endstruct" ; GUI API for setting the minimum an maximum sizes of the GUI. These don't need to be called by the end user, but rather use _GUISetSize(). Global Enum $__iMinSizeX, $__iMinSizeY, $__iMaxSizeX, $__iMaxSizeY, $__iGUISizeMax Global $__vGUISize[$__iGUISizeMax] Example() Func Example() ; Create a resizable GUI. Local $hGUI = GUICreate('', Default, Default, Default, Default, BitOR($GUI_SS_DEFAULT_GUI, $WS_SIZEBOX)) GUISetState(@SW_SHOW, $hGUI) ; Set the minimum and maximum sizes of the GUI. _GUISetSize(150, 150, 500, 500) ; Register the WM_GETMINMAXINFO message. GUIRegisterMsg($WM_GETMINMAXINFO, 'WM_GETMINMAXINFO') While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd GUIDelete($hGUI) EndFunc ;==>Example Func _GUISetSize($iMinWidth, $iMinHeight, $iMaxWidth, $iMaxHeight) $__vGUISize[$__iMinSizeX] = $iMinWidth $__vGUISize[$__iMinSizeY] = $iMinHeight $__vGUISize[$__iMaxSizeX] = $iMaxWidth $__vGUISize[$__iMaxSizeY] = $iMaxHeight EndFunc ;==>_GUISetSize Func WM_GETMINMAXINFO($hWnd, $iMsg, $wParam, $lParam) ; Original idea by Zedna & updated by guinness 21/09/12. #forceref $hWnd, $iMsg, $wParam Local $tMINMAXINFO = DllStructCreate($tagMINMAXINFO, $lParam) DllStructSetData($tMINMAXINFO, 'MinTrackSizeX', $__vGUISize[$__iMinSizeX]) DllStructSetData($tMINMAXINFO, 'MinTrackSizeY', $__vGUISize[$__iMinSizeY]) DllStructSetData($tMINMAXINFO, 'MaxTrackSizeX', $__vGUISize[$__iMaxSizeX]) DllStructSetData($tMINMAXINFO, 'MaxTrackSizeY', $__vGUISize[$__iMaxSizeY]) EndFunc ;==>WM_GETMINMAXINFO
×
×
  • Create New...