Public Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Public Declare Function GetWindowRect Lib "user32" (ByVal hwnd As Long, lpRect As RECT) As Long
Public Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Public Function GetTaskBarHeight() As Long
Dim TBHwnd As Long
Dim Wnd As RECT
TBHwnd = FindWindow("Shell_TrayWnd", vbNullString)
GetWindowRect TBHwnd, Wnd
GetTaskBarHeight = Wnd.Bottom - Wnd.Top
End Functionهذا سيساعد في وضع النافذة فوق الساعة انتظر بقية الكود:
'هذا كود الفورم Private m_top As Long Private TBH As Long Private Sub Form_Load() Image1.Picture = Form1.Image2.Picture m_top = Screen.Height TBH = GetTaskBarHeight With Me .Left = Screen.Width - .Width - 100 .Top = m_top End With tmrUp.Interval = 100 tmrUp.Enabled = True End Sub Private Sub tmrUp_Timer() Dim Diff As Long Diff = m_top - Me.Top If Diff > Me.Height + ScaleY(TBH, vbPixels, vbTwips) Then tmrUp.Enabled = False tmrDown.Interval = 100 tmrDown.Enabled = True Else Me.Top = Me.Top - 100 End If End Sub
و هذا سيقوم بوضع النافذة عند الساعة و رفعها بواسطة ال timer كل عشر ثانية



