Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 07/03/2024 in all areas

  1. ioa747

    Drag-Adjust

    I incorporated them ; https://www.autoitscript.com/forum/topic/212020-drag-adjust/ ;---------------------------------------------------------------------------------------- ; Title...........: _DragAdjust.au3 ; Description.....: Resize and reposition the GUI controls when the user drags the $DragBar. ; AutoIt Version..: 3.3.16.1 Author: ioa747 Script Version: 3.0 ; Note............: Testet in Win10 22H2 ;---------------------------------------------------------------------------------------- #AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7 #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <ComboConstants.au3> #include <ListBoxConstants.au3> #include <WinAPIGdi.au3> Global $iGuiW = 600, $iGuiH = 300, $iMargin = 4 Global $hGUI = GUICreate("Form1", $iGuiW, $iGuiH, 205, 130, $WS_OVERLAPPEDWINDOW) Global $Combo1 = GUICtrlCreateCombo("Combo1", $iMargin, $iMargin, 196, 25, BitOR($CBS_DROPDOWN, $CBS_AUTOHSCROLL)) GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKHEIGHT) ;DOCK ctrl Global $List1 = GUICtrlCreateList("", $iMargin, 29, 196, 267, BitOR($LBS_STANDARD, $LBS_NOINTEGRALHEIGHT)) Global $Edit1 = GUICtrlCreateEdit("Edit1", 204, $iMargin, 392, 292) Global $DragBar = GUICtrlCreateLabel("", 200, 0, $iMargin, 315, $SS_CENTERIMAGE, $WS_EX_LAYERED) GUICtrlSetCursor(-1, 13) GUISetState(@SW_SHOW) ;********************************** While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $GUI_EVENT_PRIMARYDOWN _DragAdjust() Case $GUI_EVENT_RESIZED, $GUI_EVENT_MAXIMIZE, $GUI_EVENT_RESTORE _DragAdjust(True) EndSwitch Sleep(10) WEnd ;********************************** Func _DragAdjust($bResized = False) Local Static $iOffset = $iMargin / 2 Local Static $iPrevMousePos = -1 If Not WinActive($hGUI) Then Return SetError(1, 0, False) If $bResized = True Then ;OrderPos Local $aWin = WinGetClientSize($hGUI) Local $aDockCtrl = ControlGetPos($hGUI, "", $Combo1) ;DOCK ctrl $iGuiW = $aWin[0] $iGuiH = $aWin[1] GUICtrlSetPos($DragBar, $iMargin + $aDockCtrl[2], 0, $iMargin, $iGuiH) GUICtrlSetPos($List1, $iMargin, 2 * $iMargin + $aDockCtrl[3], $aDockCtrl[2], $iGuiH - (3 * $iMargin + $aDockCtrl[3])) GUICtrlSetPos($Edit1, 2 * $iMargin + $aDockCtrl[2], $iMargin, $iGuiW - (3 * $iMargin + $aDockCtrl[2]), $iGuiH - (2 * $iMargin)) Else Local $aCtrl = GUIGetCursorInfo($hGUI) Local $ActiveCtrl = IsArray($aCtrl) ? $aCtrl[4] : 0 If $ActiveCtrl <> $DragBar Then Return SetError(2, 0, False) Opt("MouseCoordMode", 2) ;1=absolute, 0=relative, 2=client If $aCtrl[2] = 1 Then ;Primary down While $aCtrl[2] $aCtrl = GUIGetCursorInfo($hGUI) Local $iMousePos = MouseGetPos(0) $iMousePos = $iMousePos < $iMargin ? $iMargin : $iMousePos > ($iGuiW - $iMargin) ? $iGuiW - $iMargin : $iMousePos If $iMousePos <> $iPrevMousePos Then GUICtrlSetPos($DragBar, $iMousePos - $iOffset) GUICtrlSetPos($Combo1, $iMargin, Default, $iMousePos - $iMargin - $iOffset) GUICtrlSetPos($List1, $iMargin, Default, $iMousePos - $iMargin - $iOffset) GUICtrlSetPos($Edit1, $iMousePos + $iOffset, Default, $iGuiW - $iMousePos - $iMargin - $iOffset) $iPrevMousePos = $iMousePos EndIf Sleep(10) WEnd EndIf Opt("MouseCoordMode", 1) ;1=absolute, 0=relative, 2=client EndIf _WinAPI_RedrawWindow($hGUI) EndFunc ;==>_DragAdjust ;--------------------------------------------------------------------------------------------------------------------------------
    1 point
  2. or RunWait (@comspec & " /c TaskKill /PID " & $PID & " /F") That will work all the times. Tested for life !
    1 point
×
×
  • Create New...