Getting the User Idle time

by Richard Russell, October 2011

The User Idle time is the time since the user last interacted with the PC, for example by pressing a key or moving the mouse. It's useful for things like determining when to display a screensaver.

It's quite easy to get the User Idle time in BBC BASIC:

        DIM lii{cbSize%, dwTime%}
        lii.cbSize% = DIM(lii{})
        SYS "GetLastInputInfo", lii{}
        SYS "GetTickCount" TO tick%
        PRINT "User Idle time is "; (tick%-lii.dwTime%)/1000 " seconds"