GetIdleTime
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.
Syntax
DWORD GetIdleTime (void);
Parameters
None.
Return Value
The number of milliseconds that the system has been idle. If GetIdleTime returns MAXDWORD, this functionality is not supported by your platform.
Remarks
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));
Requirements
Header | winbase.h |
Library | coredll.lib |
Windows Embedded CE | Windows CE 3.0 and later |
Windows Mobile | Windows Mobile Version 5.0 and later |
See Also
Reference
Time Functions
GetTickCount
Sleep