LASTINPUTINFO lpi;lpi.cbSize = sizeof(lpi);GetLastInputInfo(&lpi);int iTime = GetTickCount() - lpi.dwTime;