Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Code to detect a period of inactivity? with GetLastInputInfo

256 views
Skip to first unread message

Joep Borghans

unread,
Sep 7, 2018, 2:11:55 PM9/7/18
to
I have declared:

MODULE(‘WIN32’)
GetTickCount(),ULONG,PASCAL
GetLastInputInfo(LONG),ULONG,PASCAL
END

Can someone provide me with some code on how to use these procedures?

Thanks,
Joep

sand...@yahoo.com

unread,
Sep 10, 2018, 4:15:10 AM9/10/18
to
Hi.
I've never used it.
Some basic information can be found on MSC site:
https://msdn.microsoft.com/en-us/library/windows/desktop/ms724408(v=vs.85).aspx
https://docs.microsoft.com/en-us/windows/desktop/api/winuser/nf-winuser-getlastinputinfo
https://docs.microsoft.com/en-us/windows/desktop/api/winuser/ns-winuser-taglastinputinfo

At the beginning of testing period you have to call GetTickCount and GetLastInputInfo and then you have to periodically check out if the last input event is changed (which is stored in dwTime of the tagLASTINPUTINFO structure returned by GetLastInputInfo).
For periodically checking you have to set Timer in procedures's Window properties which will create timer embed where you have to put code for calling GetLastInputInfo function ...
Hope this helps.

Zoran.











Joep Borghans

unread,
Sep 11, 2018, 8:30:30 AM9/11/18
to
Op vrijdag 7 september 2018 20:11:55 UTC+2 schreef Joep Borghans:
Hi Zoran,

Thanks.
I now know how it works.
I created a structure along the global map declarations:

Global Data
LIF GROUP()
cbSize UNSIGNED
dwTime ULONG
END

Code:
LIF:cbSize = Size(LIF)
If getlastinputinfo(ADDRESS(LIF))
If GetTickCount() - LIF:dwTime > 900000 !15 min
Message('TickCount=' & GetTickCount() & ' dwTime=' & LIF:dwTime)
End
End

I aspected it to be the idle time for my application, but it seems to be the idle time for the entire system (Windows 10)
Does anyone know a function which is specific for my clarion application only?

Regards,
Joep
0 new messages