Is it possible to use C++ to simulate keypress? What I mean by that I mean is it possible to use C++ to emulate your keyboard to type out a word. If you are still confused about what I am talking about (Like the rest of the internet) then what I am trying to say is if there is a way to copy something like pyautogui and pynput in C++. I've looked everywhere for an answer but all I saw was key detection. I want to know how to do this because my friends keep spamming me so I want to get my revenge by making a spam bot. Here's the code so far..
#include <iostream>
#include <windows.h>
using namespace std;
string message = "Lol";
float delay = 0.2f;
void click_to_location()
{
Sleep(5000);
SetCursorPos(525, 665);
Sleep(10);
mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0);
mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0);
Sleep(10);
}
int main()
{
while (true)
{
if (GetAsyncKeyState(0x51))
{
exit(0);
}
// Help with key Press here
Sleep(10);
// Help with key Release here
}
return 0;
}
Also ignore my bad programming skills.