Jump to content

Search the Community

Showing results for tags 'form drag'.

  • 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 1 result

  1. Example of Intercepting WM_MOVING to restrict area the window can be moved to ;Autoit v3.3.14.5 Limit Form Move Example-- Bilgus 2018 #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <WinAPISysWin.au3> ;_WinAPI_DefWindowProc() Global $g_hGUI, $g_idLimit Global $g_aWindowLimits = [15, 10, @DesktopWidth / 2, @DesktopHeight / 2] ; Min X, Min Y, Max X, Max Y GUIRegisterMsg($WM_MOVING, WM_MOVING) ;Register a callback function for $WM_MOVING Example() Func Example() ; Create a GUI with various controls. $g_hGUI = GUICreate("Example") $g_idLimit = GUICtrlCreateCheckbox("Limit Drag", 10, 370, 85, 25) Local $idOK = GUICtrlCreateButton("OK", 310, 370, 85, 25) ; Display the GUI. GUISetState(@SW_SHOW, $g_hGUI) ; Loop until the user exits. While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE, $idOK ExitLoop EndSwitch WEnd ; Delete the previous GUI and all controls. GUIDelete($g_hGUI) EndFunc ;==>Example Func WM_MOVING($hWnd, $iMsg, $wParam, $lParam) If $hWnd = $g_hGUI Then Local $bLimited = False ;Current rect is passed in lParam Local $tRect = DllStructCreate($tagRect, $lParam) ; (IS NOT X, Y, W, H) => (IS X, Y, X+W, Y+H) Local $iLeft = DllStructGetData($tRect, 1) Local $iTop = DllStructGetData($tRect, 2) Local $iRight = DllStructGetData($tRect, 3) Local $iBottom = DllStructGetData($tRect, 4) Local $iWidth, $iHeight ;Check left and right of window against imposed limits If $iLeft < $g_aWindowLimits[0] Then $iWidth = $iRight - $iLeft ;Calculate Original Width $iLeft = $g_aWindowLimits[0] $iRight = $iLeft + $iWidth ;Have to keep our same Width $bLimited = True ElseIf $iRight > $g_aWindowLimits[2] Then $iWidth = $iRight - $iLeft ;Calculate Original Width $iRight = $g_aWindowLimits[2] $iLeft = $iRight - $iWidth ;Have to keep our same Width $bLimited = True EndIf ;Check top and bottom of window against imposed limits If $iTop < $g_aWindowLimits[1] Then $iHeight = $iBottom - $iTop ;Calculate Original Height $iTop = $g_aWindowLimits[1] $iBottom = $iTop + $iHeight ;Have to keep our same Height $bLimited = True ElseIf $iBottom > $g_aWindowLimits[3] Then $iHeight = $iBottom - $iTop ;Calculate Original Height $iBottom = $g_aWindowLimits[3] $iTop = $iBottom - $iHeight ;Have to keep our same Height $bLimited = True EndIf If $bLimited And BitAND(GUICtrlRead($g_idLimit), $GUI_CHECKED) Then ;Limit happened -- Pass new Values Back to WndProc DllStructSetData($tRect, 1, $iLeft) DllStructSetData($tRect, 2, $iTop) DllStructSetData($tRect, 3, $iRight) DllStructSetData($tRect, 4, $iBottom) _WinAPI_DefWindowProc($hWnd, $iMsg, $wParam, $lParam);Pass new Rect on to default window procedure Return 1 ; True EndIf EndIf Return $GUI_RUNDEFMSG ;Default Handler EndFunc ;==>WM_MOVING
×
×
  • Create New...