Small program to stop the screen saver or screen blanking by moving cursor.

#include <iostream>
#include <windows.h>

bool iskeypressed(unsigned timeout_ms = 0)
{
    return WaitForSingleObject(
        GetStdHandle(STD_INPUT_HANDLE),
        timeout_ms
    ) == WAIT_OBJECT_0;
}

int main()
{
    POINT cursor;
    GetCursorPos(&cursor);

    std::cout << "Press any key to stop the program!\n";

    while (!iskeypressed(500)) {
        cursor.x += 10;
        SetCursorPos(cursor.x, cursor.y);
        Sleep(1000);

        cursor.x -= 10;
        SetCursorPos(cursor.x, cursor.y);
        Sleep(500);
    }

    std::cout << "Bye, Bye!\n";
    return 0;
}