We use GetLastInputInfo and calculate the difference from the result of GetTickCount64 to determine idleness. However, the tick count returned by GetLastInputInfo is written
There is a workaround that we use.
Only use the result of GetLastInputInfo()
to detect if the dwTick
has changed without caring how much it changed.
Do this periodically.
When the tick has changed (the value is not the same as it was the previous reading) start your own timer and use that to detect when the input has became idle for for instance 30 seconds.
You will never need to deal with wraparounds using this approach.