Advertisement
Guest User

Untitled

a guest
May 26th, 2017
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <WindowsConstants.au3>
  2. #include <Misc.au3>
  3. HotKeySet({F3}, _Exit)
  4. Global $hWnd = GUICreate(Untitled, 100, 100, Default, Default, -$WS_POPUP)
  5. GUICtrlSetColor(-1, 0xFFFFFF)
  6. GUISetState(@SW_SHOW)
  7. While 1
  8.     _WinAPI_CheckWinMove($hWnd)
  9. WEnd
  10. Func _Exit()
  11.     Exit
  12. EndFunc
  13.  
  14. ; #FUNCTION# ====================================================================================================================
  15. ; Name...........: _WinAPI_CheckWinMove
  16. ; Description ...: Checks if a Gui need to move While dragging
  17. ; Syntax.........: _WinAPI_CheckWinMove($hWnd[, $sMCode])
  18. ; Parameters ....: $hWnd   - Handle to the Gui
  19. ; [optional]       $sMCode - Code of Button (Please use Mouse Codes) for func _Ispressed()
  20. ; Return values .: none
  21. ; Author ........: black_skorpi
  22. ; Modified.......:
  23. ; Remarks .......: Pauses the Script
  24. ; Related .......:
  25. ; Link ..........:
  26. ; Example .......: Yes
  27. ; ===============================================================================================================================
  28.  
  29. Func _WinAPI_CheckWinMove($hWnd, $sMCode = 01)
  30.     Global $aMPos, $aWPos, $aMPosOld = MouseGetPos()
  31.     While _IsPressed(01)
  32.         $aMPos = MouseGetPos()
  33.         $aWPos = WinGetPos(WinGetTitle($hWnd, "))
  34.         If Not ($aMPos[0] = $aMPosOld) And ($aMPos[1] = $aMPosOld[1]) Then
  35.             WinMove(WinGetTitle($hWnd, "), ", $aWPos[0] - ($aMPosOld[0] - $aMPos[0]), $aWPos[1] - ($aMPosOld[1] - $aMPos[1]), $aWPos[2], $aWPos[3])
  36.         EndIf
  37.         $aMPosOld = $aMPos
  38.     WEnd
  39. EndFunc
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement