REATIVAR TIMER NO LOOP
Pessoal peguei aqui um codigo de um amigo que faz uma form como a cx box do msn que subia com uma mensagem. o fato é que eu gostaria que depois que ele aparecesse e ficasse um tempo ele entao começasse a contar tipo 20 minutos e voltar e fazer o mesmo processo. segue o codigo que peguei.
Option Explicit
Private Const SWP_NOMOVE = &H2
Private Const SWP_NOSIZE = &H1
Private Const HWND_TOPMOST = -1
Private Const HWND_NOTOPMOST = -2
Private Const SPI_GETWORKAREA = 48
Private Const GWL_EXSTYLE = (-20)
Private Const WS_EX_LAYERED = &H80000
Private Const WS_EX_TRANSPARENT = &H20&
Private Const LWA_ALPHA = &H2&
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 GetWindowLong Lib [Ô]user32[Ô] Alias [Ô]GetWindowLongA[Ô] (ByVal hwnd As Long, ByVal nIndex As Long) As Long
Private Declare Function SetWindowLong Lib [Ô]user32[Ô] Alias [Ô]SetWindowLongA[Ô] (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Private Declare Function SetLayeredWindowAttributes Lib [Ô]user32[Ô] (ByVal hwnd As Long, ByVal crey As Byte, ByVal bAlpha As Byte, ByVal dwFlags As Long) As Long
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 Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Private I As Integer
Private NormalWindowStyle As Long
Private TaskBar As Long
Private Sub GradientForm(ByVal frmIn As Form)
Dim I As Integer
Dim Y As Integer
With frmIn
.AutoRedraw = True
.DrawStyle = 6
.DrawMode = 13
.DrawWidth = 2
.ScaleMode = 3
.ScaleHeight = (256 * 2)
End With
For I = 0 To 255
frmIn.Line (0, Y)-(frmIn.Width, Y + 2), RGB(255, 255, I * 1.3), BF
Y = Y + 2
Next I
End Sub
Private Sub Form_Load()
Me.Show
Me.Top = Screen.Height
Me.Left = Screen.Width - Me.Width - 50
NormalWindowStyle = GetWindowLong(Me.hwnd, GWL_EXSTYLE)
SetWindowLong Me.hwnd, GWL_EXSTYLE, NormalWindowStyle Or WS_EX_LAYERED
SetLayeredWindowAttributes Me.hwnd, 0, 255, LWA_ALPHA
GradientForm Me
I = 100
End Sub
Private Sub Timer1_Timer()
Dim WindowRect As RECT
SystemParametersInfo SPI_GETWORKAREA, 0, WindowRect, 0
TaskBar = ((Screen.Height / Screen.TwipsPerPixelX) - WindowRect.Bottom) * Screen.TwipsPerPixelX
If (Me.Top + Me.Height + TaskBar) > Screen.Height Then
Me.Top = Me.Top - 30
Else
SetWindowPos hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE + SWP_NOSIZE
Timer2.Enabled = True
End If
End Sub
Private Sub Timer2_Timer()
Timer1.Enabled = False
Timer3.Enabled = True
SetWindowPos hwnd, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE + SWP_NOSIZE
End Sub
Private Sub Timer3_Timer()
If Me.Top < Screen.Height And I > 0 Then
Me.Top = Me.Top + 30
I = I - 1.5
Timer4.Enabled = True
Else
[ô]Timer4.Enabled = True
[ô]Unload Me
End If
End Sub
Option Explicit
Private Const SWP_NOMOVE = &H2
Private Const SWP_NOSIZE = &H1
Private Const HWND_TOPMOST = -1
Private Const HWND_NOTOPMOST = -2
Private Const SPI_GETWORKAREA = 48
Private Const GWL_EXSTYLE = (-20)
Private Const WS_EX_LAYERED = &H80000
Private Const WS_EX_TRANSPARENT = &H20&
Private Const LWA_ALPHA = &H2&
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 GetWindowLong Lib [Ô]user32[Ô] Alias [Ô]GetWindowLongA[Ô] (ByVal hwnd As Long, ByVal nIndex As Long) As Long
Private Declare Function SetWindowLong Lib [Ô]user32[Ô] Alias [Ô]SetWindowLongA[Ô] (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Private Declare Function SetLayeredWindowAttributes Lib [Ô]user32[Ô] (ByVal hwnd As Long, ByVal crey As Byte, ByVal bAlpha As Byte, ByVal dwFlags As Long) As Long
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 Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Private I As Integer
Private NormalWindowStyle As Long
Private TaskBar As Long
Private Sub GradientForm(ByVal frmIn As Form)
Dim I As Integer
Dim Y As Integer
With frmIn
.AutoRedraw = True
.DrawStyle = 6
.DrawMode = 13
.DrawWidth = 2
.ScaleMode = 3
.ScaleHeight = (256 * 2)
End With
For I = 0 To 255
frmIn.Line (0, Y)-(frmIn.Width, Y + 2), RGB(255, 255, I * 1.3), BF
Y = Y + 2
Next I
End Sub
Private Sub Form_Load()
Me.Show
Me.Top = Screen.Height
Me.Left = Screen.Width - Me.Width - 50
NormalWindowStyle = GetWindowLong(Me.hwnd, GWL_EXSTYLE)
SetWindowLong Me.hwnd, GWL_EXSTYLE, NormalWindowStyle Or WS_EX_LAYERED
SetLayeredWindowAttributes Me.hwnd, 0, 255, LWA_ALPHA
GradientForm Me
I = 100
End Sub
Private Sub Timer1_Timer()
Dim WindowRect As RECT
SystemParametersInfo SPI_GETWORKAREA, 0, WindowRect, 0
TaskBar = ((Screen.Height / Screen.TwipsPerPixelX) - WindowRect.Bottom) * Screen.TwipsPerPixelX
If (Me.Top + Me.Height + TaskBar) > Screen.Height Then
Me.Top = Me.Top - 30
Else
SetWindowPos hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE + SWP_NOSIZE
Timer2.Enabled = True
End If
End Sub
Private Sub Timer2_Timer()
Timer1.Enabled = False
Timer3.Enabled = True
SetWindowPos hwnd, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE + SWP_NOSIZE
End Sub
Private Sub Timer3_Timer()
If Me.Top < Screen.Height And I > 0 Then
Me.Top = Me.Top + 30
I = I - 1.5
Timer4.Enabled = True
Else
[ô]Timer4.Enabled = True
[ô]Unload Me
End If
End Sub
Nenhuma dica de como reativar este processo?
em anexo ......
Tópico encerrado , respostas não são mais permitidas