Private Declare Function GetWindowRect Lib "user32" _
(ByVal hWnd As Long, lpRect As RECT) As Long Public Declare Function FindWindowEx Lib "user32" _ Alias "FindWindowExA" (ByVal hWnd1 As Long, _ ByVal hWnd2 As Long, ByVal lpsz1 As String, _ ByVal lpsz2 As String) As Long Type RECT Left As Long Top As Long Right As Long Bottom As Long End Type Private Sub Timer1_Timer() Dim tRect As RECT If Me.Left < 700 Then Me.Left = 0 If Me.Left > 7500 Then Me.Left = Screen.Width - Width If Me.Top < 700 Then Me.Top = 0 If Me.Top > 7500 Then Call GetWindowRect(FindWindowEx(0&, 0&, _ "Shell_TrayWnd", vbNullString), tRect) Top = ScaleY(tRect.Top, vbPixels, vbTwips) - Height Exit Sub End If End Sub |