Skip to content

Instantly share code, notes, and snippets.

@prabindh
Created April 10, 2020 02:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save prabindh/9dee285a38c4b708811f1fce7a36eca5 to your computer and use it in GitHub Desktop.
Save prabindh/9dee285a38c4b708811f1fce7a36eca5 to your computer and use it in GitHub Desktop.
// Prabindh Sundareson 2020
// Age of the lockdown
#include "pch.h" // include #include "httplib.h" in this file
#include <iostream>
static httplib::Server svr;
void pressSpace()
{
INPUT ip;
ip.type = INPUT_KEYBOARD;
ip.ki.time = 0;
ip.ki.dwFlags = 0;
ip.ki.wScan = 0;
ip.ki.wVk = VK_SPACE;
ip.ki.dwExtraInfo = 0;
SendInput(1, &ip, sizeof(INPUT));
// Release the key
ip.ki.dwFlags = KEYEVENTF_KEYUP;
SendInput(1, &ip, sizeof(INPUT));
}
int main()
{
std::cout << "Hello World!\n";
svr.Post("/", [&](const auto& req, auto& res) {
pressSpace();
std::cout << "Received\n";
});
svr.listen("10.41.2.37", 8000);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment