GetIdleTime (Windows CE 5.0)

Send Feedback

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

DWORD GetIdleTime (void);



Return Values

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


The support for this function is dependent on the OEM's implementation of the curridlelow, curridlehigh, and idleconv variables in the OEM adaptation layer (OAL).

GetIdleTime returns an idle time equivalent to (DWORD) ((((ULONGLONG) curridlehigh) << 32 + curridlelow) / idleconv).

If idleconv is set to 0, then GetIdleTime is not implemented and the kernel returns MAXDWORD. If idleconv is set to a non-zero value, then this API is implemented and the OAL must update curridlelow and curridlehigh correctly.

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();
//  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));


OS Versions: Windows CE 3.0 and later.
Header: Winbase.h.
Link Library: Coredll.lib.

See Also

curridlehigh | curridlelow | idleconv | GetTickCount | InitClock | Sleep

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.