USUÁRIO:      SENHA:        SALVAR LOGIN ?    Adicione o VBWEB na sua lista de favoritos   Fale conosco 

 

  Dicas

  Visual Basic    (ActiveX/Controles/DLL)

Título da Dica:  Criando um timer no seu form sem componente so API
Postada em 14/3/2004 por Andre            
'Esse projeto precisa de um formulario e um modulo
'no formulario coloque dois botoes, command1 e command2

'No Fomulario
Private Declare Function CreateTimerQueue Lib "kernel32.dll" () As Long
Private Declare Function CreateTimerQueueTimer Lib "kernel32.dll" (ByRef phNewTimer As Long, ByVal TimerQueue As Long, ByVal Callback As Long, ByVal Parameter As Long, ByVal DueTime As Long, ByVal Period As Long, ByVal Flags As Long) As Long
Private Declare Function DeleteTimerQueue Lib "kernel32.dll" (ByVal TimerQueue As Long) As Long
Private Declare Function DeleteTimerQueueTimer Lib "kernel32.dll" (ByVal TimerQueue As Long, ByVal Timer As Long, ByVal CompletionEvent As Long) As Long

Private hQueue As Long
Private hTimer As Long

Private Sub Form_Load()
    hQueue = CreateTimerQueue()
    Command1.Caption = "Start"
    Command2.Caption = "Stop"
End Sub
Private Sub Form_Unload(Cancel As Integer)
    DeleteTimerQueue hQueue
End Sub
Private Sub Command1_Click()
    If hTimer = 0 Then
        CreateTimerQueueTimer hTimer, hQueue, AddressOf TimerCallBack, ByVal 0&, 0, 1000, 0
    End If
End Sub
Private Sub Command2_Click()
    If hTimer <> 0 Then
        DeleteTimerQueueTimer hQueue, hTimer, ByVal 0&
        hTimer = 0
    End If
End Sub


'No Modulo
Public Sub TimerCallBack(ByVal lpParameter As Long, ByVal TimerOrWaitFired As Long)
    Debug.Print "O tempo ta rolado..."
End Sub


 


CyberWEB Network Ltda.    © Copyright 2000-2024   -   Todos os direitos reservados.
Powered by HostingZone - A melhor hospedagem para seu site
Topo da página