美好的一天, 我創建了一個具有自動註銷功能的vb6程序。我使用的API,它工作正常,但只在mdiChild形式。無論何時以模式形式加載表單,計時器都會停止。我嘗試逐行模擬我的代碼,然後發現代碼在「Form1.show vbmodal」上停止。我應該怎麼做才能繼續計時器,甚至將表格加載爲vbmodal?任何幫助將不勝感激。提前致謝。 對了,這裏是我的代碼:當VBModal窗體加載時,API計時器停止 - vb6
Private Declare Function GetQueueStatus Lib "user32.dll" (ByVal fuFlags As Long) As Long
'API For Inactivity Monitoring SMQ
Private Const QS_KEY = &H1
Private Const QS_MOUSEMOVE = &H2
Private Const QS_MOUSEBUTTON = &H4
Private Const QS_TIMER = &H10
Private Const QS_MOUSE = (QS_MOUSEMOVE Or QS_MOUSEBUTTON)
Private Const QS_INPUT = (QS_MOUSE Or QS_KEY)
Private Const QS_ALLEVENTS = (QS_MOUSE Or QS_KEY Or QS_TIMER)
Public Sub CheckInputIdle(ByVal TimeOut As Long)
Dim lTimer As Long
lTimer=Timer
Do While gCancelAutoLogOff = False
DoEvents
If GetQueueStatus(QS_INPUT) Then
lTimer = Timer
End If
If Timer - lTimer >= TimeOut Then Exit Do
Loop
If gCancelAutoLogOff = False Then
gCancelAutoLogOff = True
MainForm.Logoff
End If
End Sub
感謝C-Pound Guru – codesdozer
我想我必須在模態窗體加載時再次調用API Timer函數。 – codesdozer