APIを使ったタイマー
スポンサードリンク






Option Compare Database

'Windowsが起動してからの時間
Private Declare Function GetTickCount Lib "kernel32" () As Long

'タイマー
Private Sub AcTimer(tim As Long)
    Dim st As Long
    
    tim = tim * 1000
    '開始時間
    st = GetTickCount
    DoEvents
    Do
        If GetTickCount - st >= tim Then
            '時間経過
            Exit Do
        End If
        DoEvents
    Loop
End Sub

'コマンドボタン クリックイベント
Private Sub コマンド0_Click()
    コマンド0.Caption = "Start"
    '10秒間タイマー
    ExTimer 10
    コマンド0.Caption = "Stop"
End Sub



Access-Access!

Copyright(C) FeedSoft