GetIdleTime

Windows Mobile 6.5
A version of this page is also available for
4/8/2010

This function returns the amount of time, in milliseconds, that the system has been idle.


DWORD GetIdleTime (void);

None.

The number of milliseconds that the system has been idle. If GetIdleTime returns MAXDWORD, this functionality is not supported by your platform.

The following code example shows how to determine how long the device has idled by wrapping a call to GetIdleTime with calls to GetTickCount.

dwStartTick = GetTickCount();
dwIdleSt = GetIdleTime();
//  You must insert a call to the Sleep(sleep_time) function to allow
//  idle time to accrue. An example of an appropriate sleep time is
//  1000 ms.
dwStopTick = GetTickCount();
dwIdleEd = GetIdleTime();
PercentIdle = ((100*(dwIdleEd - dwIdleSt)) / (dwStopTick - dwStartTick));

Headerwinbase.h
Librarycoredll.lib
Windows Embedded CEWindows CE 3.0 and later
Windows MobileWindows Mobile Version 5.0 and later

Community Additions

Show: