Partager via


GetIdleTime

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

DWORD GetIdleTime (void);

Parameters

None.

Return Values

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

Remarks

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

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();
Sleep();
dwStopTick = GetTickCount();
dwIdleEd = GetIdleTime();
PercentIdle = ((100*(dwIdleEd - dwIdleSt)) / (dwStopTick - dwStartTick));

The Sleep is required to allow other threads in the system to run during a period of time.

Requirements

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

See Also

curridlehigh | curridlelow | idleconv | GetTickCount | InitClock

Last updated on Wednesday, April 13, 2005

© 2005 Microsoft Corporation. All rights reserved.