; #FUNCTION# ==================================================================================================================== ; Name...........: _GuiSnap ; Description ...: When the gui window is close the the desktop borders, it snaps the the sides, and corners. ; Syntax.........: _GuiSnap($aTitle[, $hText = ""[, $hDistance = 35[, $sXy = 4[, $TaskBar = 34]]]]) ; Parameters ....: $aTitle - The title of the window . ; $hText - [optional]The text of the window. ; $hDistance - [optional]The distance before the Gui snaps in pixels. Default = 35 ; $sXy - [optional]The x and y placement of the window. Default = 4 ; $TaskBar - [optional]The height of the task bar. Default = 34 ; Return values .: Success - True ; Failure - False ; Author ........: Bill Reithmeyer (billthecreator) ; Modified.......: 07.22.2008 9:07 AM ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _GuiSnap($aTitle, $hText = "", $hDistance = 35, $sXy = 4, $TaskBar = 34) Local $wSize If $aTitle = "" Then SetError(1) Else $wSize = WinGetPos($aTitle) If $wSize[0] < $hDistance And $wSize[1] < $hDistance Then ; Top Left Hand Corner WinMove($aTitle, $hText, $sXy, $sXy) ElseIf $wSize[0] < $hDistance Then ; Left Side Of Desktop WinMove($aTitle, $hText, $sXy, $wSize[1]) ElseIf $wSize[1] < $hDistance Then ; Top Of Desktop WinMove($aTitle, $hText, $wSize[0], $sXy) EndIf If $wSize[0] > @DesktopWidth - $hDistance - $wSize[2] And $wSize[1] < $hDistance Then ; Top Right Hand Corner WinMove($aTitle, $hText, @DesktopWidth - $sXy - $wSize[2], $sXy) ElseIf $wSize[0] > @DesktopWidth - $hDistance - $wSize[2] Then ; Right Side Of Desktop WinMove($aTitle, $hText, @DesktopWidth - $sXy - $wSize[2], $wSize[1]) EndIf If $wSize[1] > @DesktopHeight - $hDistance - $TaskBar - $wSize[3] And $wSize[0] < $hDistance Then ; Bottom Left Hand Corner WinMove($aTitle, $hText, $sXy, @DesktopHeight - $TaskBar - $wSize[3]) ElseIf $wSize[1] > @DesktopHeight - $hDistance - $TaskBar - $wSize[3] Then ; Bottom Of Desktop WinMove($aTitle, $hText, $wSize[0], @DesktopHeight - $TaskBar - $wSize[3]) EndIf If $wSize[1] > @DesktopHeight - $hDistance - $TaskBar - $wSize[3] And $wSize[0] > @DesktopWidth - $hDistance - $wSize[2] Then ; Bottom Right Hand Corner WinMove($aTitle, $hText, @DesktopWidth - $sXy - $wSize[2], @DesktopHeight - $TaskBar - $wSize[3]) EndIf EndIf EndFunc ;==>_GuiSnap
Edited by billthecreator, 22 July 2008 - 07:43 PM.





