Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <WindowsConstants.au3>
- #include <Misc.au3>
- HotKeySet({F3}, _Exit)
- Global $hWnd = GUICreate(Untitled, 100, 100, Default, Default, -$WS_POPUP)
- GUICtrlSetColor(-1, 0xFFFFFF)
- GUISetState(@SW_SHOW)
- While 1
- _WinAPI_CheckWinMove($hWnd)
- WEnd
- Func _Exit()
- Exit
- EndFunc
- ; #FUNCTION# ====================================================================================================================
- ; Name...........: _WinAPI_CheckWinMove
- ; Description ...: Checks if a Gui need to move While dragging
- ; Syntax.........: _WinAPI_CheckWinMove($hWnd[, $sMCode])
- ; Parameters ....: $hWnd - Handle to the Gui
- ; [optional] $sMCode - Code of Button (Please use Mouse Codes) for func _Ispressed()
- ; Return values .: none
- ; Author ........: black_skorpi
- ; Modified.......:
- ; Remarks .......: Pauses the Script
- ; Related .......:
- ; Link ..........:
- ; Example .......: Yes
- ; ===============================================================================================================================
- Func _WinAPI_CheckWinMove($hWnd, $sMCode = 01)
- Global $aMPos, $aWPos, $aMPosOld = MouseGetPos()
- While _IsPressed(01)
- $aMPos = MouseGetPos()
- $aWPos = WinGetPos(WinGetTitle($hWnd, "))
- If Not ($aMPos[0] = $aMPosOld) And ($aMPos[1] = $aMPosOld[1]) Then
- WinMove(WinGetTitle($hWnd, "), ", $aWPos[0] - ($aMPosOld[0] - $aMPos[0]), $aWPos[1] - ($aMPosOld[1] - $aMPos[1]), $aWPos[2], $aWPos[3])
- EndIf
- $aMPosOld = $aMPos
- WEnd
- EndFunc
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement