vbAccelerator - Contents of code file: modTimer.bas
Attribute VB_Name = "mTimer"
Option Explicit
' Some Windows Apis
Declare Function SetTimer Lib "user32" (ByVal hWnd As Long, ByVal nIDEvent As
Long, ByVal uElapse As Long, ByVal lpTimerFunc As Long) As Long
Declare Function KillTimer Lib "user32" (ByVal hWnd As Long, ByVal nIDEvent As
Long) As Long
Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hWnd As
Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Public iPercent As Integer ' We do not know this, but simulate a progress anyway
' The user thinks it works faster then!
Private TimerID As Long
Public Sub CreateTimer(ByVal interval As Long)
TimerID = SetTimer(0&, 0&, interval, AddressOf TimerProc)
End Sub
Public Sub DestroyTimer()
KillTimer 0&, TimerID
End Sub
Public Function TimerProc&(ByVal hWnd&, ByVal wMsg&, ByVal wParam&, ByVal
lParam&)
With frmjpg
iPercent = iPercent + 1
If iPercent >= 100 Then
DestroyTimer
Exit Function
End If
frmjpg.pSingle.Value = iPercent
DoEvents
End With
End Function
Public Sub Progress()
frmjpg.pSingle.Value = iPercent
End Sub
|
|