gurj wrote:i need #wm_systimer, when user sleeping.
no you dont.
as i said earlier, the frequency of how often you will receive that message, depends on the current users blinkrate settings and will differ from system to system. since its an undocumented feature, it may rely on other things as well. who knows. also what if the user has the caret disabled? you probably wont get that message at all.
ElapsedMilliseconds() is meant to measure the delta between two calls. it was never meant to be used as you do in your example. the internal behavior of ElapsedMilliseconds() changed in the past and may change again in the future, so you really shouldnt use it like that.
if you need idle detection, you could use GetLastInputInfo_() for example:
Code: Select all
Procedure TimeLastInput()
Protected lii.LASTINPUTINFO\cbSize = SizeOf(LASTINPUTINFO)
GetLastInputInfo_(@lii)
ProcedureReturn lii\dwTime
EndProcedure
OpenWindow(0, #PB_Ignore, #PB_Ignore, 400, 300, "Test", #PB_Window_SystemMenu)
AddWindowTimer(0, 0, 1000)
Repeat
Select WaitWindowEvent()
Case #PB_Event_Timer
If EventTimer() = 0
TimeDelta = GetTickCount_() - TimeLastInput()
Debug "Last Input: "+Str(TimeDelta / 1000)+" Seconds ago"
EndIf
Case #PB_Event_CloseWindow
Break
EndSelect
Until TimeDelta >= 5000
c ya,
nco2k