Code: Select all
;WaitWindowEvent gives no longer #PB_Event_TimeOut if an API-Timer is running
;with smaller timer value than WaitWindowEvent(TimeOut)
;and the window has lost the focus
;start and focus an other window (debugger...)
#wIDmain = 0
#tIDtimer = 0
#PB_Event_TimeOut = 0
Procedure TimerCallback(WindowID, message, wParam, lParam)
result = #PB_ProcessPureBasicEvents
If message = #WM_TIMER ;Timer-Intervall
Debug "TimerCallback " + Str(wParam)
result = 0
EndIf ;message
ProcedureReturn result
EndProcedure
If OpenWindow(#wIDmain, 50, 50, 200, 150, "WaitWindowEvent TimeOut")
SetTimer_(WindowID(#wIDmain), #tIDtimer, 200, @TimerCallback()) ; <= change timer value
Repeat
EventID.l = WaitWindowEvent(500)
If EventID = #PB_Event_TimeOut
Debug "TimeOut"
EndIf
Until EventID = #PB_Event_CloseWindow
EndIf
KillTimer_(WindowID(#wIDmain), #tIDtimer) ;Timer entfernen
End
Sven