'www.norksoft.cn
Private Declare Function SystemParametersInfo Lib "user32" Alias "SystemParametersInfoA" (ByVal uAction As Long, ByVal uParam As Long, ByRef lpvParam As Any, ByVal fuWinIni As Long) As Long
Private Const SPI_GETWORKAREA = 48
Private Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Private Function TaskbarHeight() As Integer
'获取任务栏高度
Dim lRes As Long
Dim rectVal As RECT
lRes = SystemParametersInfo(SPI_GETWORKAREA, 0, rectVal, 0)
TaskbarHeight = ((Screen.Height / Screen.TwipsPerPixelX) - rectVal.Bottom) * Screen.TwipsPerPixelX
End Function
Private Sub Form_Load()
'一加载窗体就让窗体置于屏幕外
Me.Move Screen.Width - Me.Width, Screen.Height + Me.Height
End Sub
Private Sub Timer1_Timer()
If Me.Top >= Screen.Height - Me.Height - TaskbarHeight Then
Me.Top = Me.Top - 100
Else
Me.Top = Screen.Height - Me.Height - TaskbarHeight
Timer1.Enabled = False
End If
End Sub