Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <GUIConstants.au3>
- #include <WindowsConstants.au3>
- #Include <APIConstants.au3>
- #include <WinAPI.au3>
- #include <Constants.au3>
- ; - Author: name22 (www.autoit.de)
- $iGUI_Width = 400 ;GUI Breite
- $iGUI_Height = 100 ;GUI Höhe
- $iMinHeight = 10 ;Größe des sichtbaren Teils der GUI (wenn sie versteckt ist)
- $iGUI_XPos = @DesktopWidth / 2 + 300 ;X-Position der GUI
- $iGUI_YPos = $iMinHeight - $iGUI_Height ;Y-Position der GUI
- $iHovertime = 1000 ;Zeit (in ms) die der Zeiger über dem Fenster verbringen muss, bis es eingeblendet wird
- $iSpeed = 5 ;Geschwindigkeit der Einblendung
- $bSliding = False
- $hGUI = GUICreate("Slide in/out", $iGUI_Width, $iGUI_Height, $iGUI_XPos, $iGUI_YPos, $WS_POPUP)
- GUISetState()
- _WinAPI_TrackMouseEvent($hGUI, BitOR($TME_HOVER, $TME_LEAVE), $iHovertime)
- GUIRegisterMsg($WM_MOUSEMOVE, "WM_MOUSEMOVE")
- GUIRegisterMsg($WM_MOUSEHOVER, "WM_MOUSEHOVER")
- GUIRegisterMsg($WM_MOUSELEAVE, "WM_MOUSELEAVE")
- While True
- Switch GUIGetMsg()
- Case $GUI_EVENT_CLOSE
- Exit
- EndSwitch
- WEnd
- Func WM_MOUSEMOVE($hWnd, $iMsg, $wParam, $lParam)
- _WinAPI_TrackMouseEvent($hGUI, BitOR($TME_HOVER, $TME_LEAVE), $iHovertime)
- EndFunc
- Func WM_MOUSEHOVER($hWnd, $iMsg, $wParam, $lParam)
- If Not $bSliding Then
- $bSliding = True
- AdlibRegister("_GUISlide", 20)
- EndIf
- EndFunc
- Func WM_MOUSELEAVE($hWnd, $iMsg, $wParam, $lParam)
- If $bSliding Then
- $bSliding = False
- AdlibUnRegister("_GUISlide")
- $iGUI_YPos = $iMinHeight - $iGUI_Height
- _WinAPI_SetWindowPos($hGUI, $HWND_TOP, $iGUI_XPos, $iGUI_YPos, 0, 0, $SWP_NOSIZE)
- EndIf
- EndFunc
- Func _GUISlide()
- If Not $bSliding Then Return
- If $iGUI_YPos < 0 Then
- $iGUI_YPos += $iSpeed
- ElseIf $iGUI_YPos > 0 Then
- $iGUI_YPos = 0
- EndIf
- _WinAPI_SetWindowPos($hGUI, $HWND_TOP, $iGUI_XPos, $iGUI_YPos, 0, 0, $SWP_NOSIZE)
- EndFunc
- ; #FUNCTION# ====================================================================================================================
- ; Name...........: _WinAPI_TrackMouseEvent
- ; Description....: Posts messages when the mouse pointer leaves a window or hovers over a window for a specified amount of time.
- ; Syntax.........: _WinAPI_TrackMouseEvent ( $hWnd, $iFlags [, $iTime] )
- ; Parameters.....: $hWnd - Handle to the window to track.
- ; Return values..: $iFlags - The services requested. This parameter can be a combination of the following values.
- ;
- ; $TME_CANCEL
- ; $TME_HOVER
- ; $TME_LEAVE
- ; $TME_NONCLIENT
- ; $TME_QUERY
- ;
- ; $iTime - The hover time-out (if $TME_HOVER was specified in $Flags), in milliseconds. Can be (-1), which
- ; means to use the system default hover time-out.
- ; Failure - 0 and sets the @error flag to non-zero.
- ; Author.........: Matt Diesel (Mat)
- ; Modified.......: Yashied
- ; Remarks........: None
- ; Related........:
- ; Link...........: @@MsdnLink@@ TrackMouseEvent
- ; Example........: Yes
- ; ===============================================================================================================================
- Func _WinAPI_TrackMouseEvent($hWnd, $iFlags, $iTime = -1)
- Local $tTME = DllStructCreate('dword;dword;hwnd;dword')
- DllStructSetData($tTME, 1, DllStructGetSize($tTME))
- DllStructSetData($tTME, 2, $iFlags)
- DllStructSetData($tTME, 3, $hWnd)
- DllStructSetData($tTME, 4, $iTime)
- Local $Ret = DllCall('user32.dll', 'int', 'TrackMouseEvent', 'ptr', DllStructGetPtr($tTME))
- If (@error) Or (Not $Ret[0]) Then
- Return SetError(1, 0, 0)
- EndIf
- Return 1
- EndFunc ;==>_WinAPI_TrackMouseEvent
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement