GetLastInputInfo function (winuser.h)

Retrieves the time of the last input event.

Syntax

BOOL GetLastInputInfo(
  [out] PLASTINPUTINFO plii
);

Parameters

[out] plii

Type: PLASTINPUTINFO

A pointer to a LASTINPUTINFO structure that receives the time of the last input event.

Return value

Type: BOOL

If the function succeeds, the return value is nonzero.

If the function fails, the return value is zero.

Remarks

This function is useful for input idle detection. However, GetLastInputInfo does not provide system-wide user input information across all running sessions. Rather, GetLastInputInfo provides session-specific user input information for only the session that invoked the function.

The tick count when the last input event was received (see LASTINPUTINFO) is not guaranteed to be incremental. In some cases, the value might be less than the tick count of a prior event. For example, this can be caused by a timing gap between the raw input thread and the desktop thread or an event raised by SendInput, which supplies its own tick count.

Requirements

Requirement Value
Minimum supported client Windows 2000 Professional [desktop apps only]
Minimum supported server Windows 2000 Server [desktop apps only]
Target Platform Windows
Header winuser.h (include Windows.h)
Library User32.lib
DLL User32.dll

See also

Conceptual

Keyboard Input

LASTINPUTINFO

Reference