' This project requires a Form and a Module
' The Form must have two command buttons (Command1
' and Command2) on it.
'
'In a form
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()
'KPD-Team 2002
'URL: http://www.allapi.net/
'E-Mail: KPDTeam@allapi.net
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
'In a module
Public Sub TimerCallBack(ByVal lpParameter As Long, ByVal TimerOrWaitFired As Long)
Debug.Print "Timer callback..."
End Sub
Сейчас этот форум просматривают: AhrefsBot, Yandex-бот и гости: 90