Option Explicit
Private Type POINTAPI
X As Long
Y As Long
End Type
Private Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal X As Long, ByVal Y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long
Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
Dim Showing As Boolean, pp As POINTAPI, nc%
Private Sub Form_Load()
Timer1.Interval =1
SetWindowPos Me.hwnd, -1, (Screen.Width - Me.Width * 2) / 14, 0, _
Width / 15, Height / 15, &H10 Or &H40
Showing = True
End Sub
Private Sub Timer1_Timer()
Dim X%, Y%
GetCursorPos pp
X = pp.X * 15
Y = pp.Y * 15
If X >= Left And X <= Left + Width And _
Y >= Top And Y <= Top + Height Then
'move mouse on it, then show it
nc = 0
If Not Showing Then
ShowIt True
End If
Else
If Showing Then
nc = nc + 1
'5*200=1 's
If nc = 5 Then
ShowIt False
End If
End If
End If
End Sub
Public Sub ShowIt(f As Boolean)
Dim i%, st%, ed%
If f Then
st = Top
ed = 0
Else
st = Top
ed = 60 - Height
End If
For i = st To ed Step IIf(f, 5, -5)
Top = i
Next i
Showing = f
End Sub