#AutoIt3Wrapper_Au3Check_Parameters=-q -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7 #include #include #include _SnapFix_Init() Global $hGUI_default = GUICreate('Default', 350, 160, 100, 100) GUICtrlCreateButton('button1', 10, 10, 100, 100) GUICtrlCreateButton('button2', 20, 120, 80, 24) GUICtrlCreateLabel('drag', 200, 60, 80, 40) GUICtrlSetFont(-1, 24, 600) GUICtrlSetColor(-1, 0xFFFFFF) GUICtrlSetState(-1, $GUI_DISABLE) GUISetState(@SW_SHOW) Global $hGUI_SnapFix = GUICreate('SnapFix', 350, 160, 150, 150) _SnapFix($hGUI_SnapFix) GUICtrlCreateButton('button1', 10, 10, 100, 100) GUICtrlCreateButton('button2', 20, 120, 80, 24) GUICtrlCreateLabel('drag', 200, 60, 80, 40) GUICtrlSetFont(-1, 24, 600) GUICtrlSetColor(-1, 0xFFFFFF) GUICtrlSetState(-1, $GUI_DISABLE) GUISetState(@SW_SHOW) Global $hGUI_SnapFix_NoTitleBar = GUICreate('SnapFix_NoTitleBar', 350, 160, 200, 200, BitOR($WS_POPUP, $WS_THICKFRAME)) _SnapFix($hGUI_SnapFix_NoTitleBar) GUICtrlCreateButton('button1', 10, 10, 100, 100) GUICtrlCreateButton('button2', 20, 120, 80, 24) GUICtrlCreateLabel('drag', 200, 60, 80, 40) GUICtrlSetFont(-1, 24, 600) GUICtrlSetColor(-1, 0xFFFFFF) GUICtrlSetState(-1, $GUI_DISABLE) GUISetState(@SW_SHOW) Global $hGUI_SnapFix_PopUp = GUICreate('SnapFix_PopUp', 350, 160, 250, 250, $WS_POPUP) ; the $WS_POPUP style alone is NOT WORKING properly! must be combined with $WS_BORDER or $WS_THICKFRAME to work. _SnapFix($hGUI_SnapFix_PopUp) GUICtrlCreateButton('button1', 10, 10, 100, 100) GUICtrlCreateButton('button2', 20, 120, 80, 24) GUICtrlCreateLabel('drag', 200, 60, 80, 40) GUICtrlSetFont(-1, 24, 600) GUICtrlSetColor(-1, 0xFFFFFF) GUICtrlSetState(-1, $GUI_DISABLE) GUISetState(@SW_SHOW) GUIRegisterMsg($WM_NCHITTEST, '_WM_NCHITTEST') ; to allow drag by the GUI body, not only by the titlebar ; this MsgBox is used for blocking the script from closing, while you drag the other windows around. MsgBox(64, 'SnapFix Example', 'Drag any of the windows way out off screen, see how each of them react. ' & @LF & @LF & 'Confirm this MsgBox to close the program. ') Func _WM_NCHITTEST($hWnd, $iMsg, $iwParam, $ilParam) #forceref $hWnd, $iMsg, $iwParam, $ilParam Return $HTCAPTION EndFunc ;==>_WM_NCHITTEST