I think that I worded my previous post incorrectly. What I meant to ask was, how are bots made in c++? For instance, how does a bot for a pc game move your character/player/whatever without you actually doing it--you could be taking a shower and you can have a bot running to control the character in the game. Does the bot( program from now on) give the hardware commands that the game responds to OR does the program give the game commands directly?
Generally, programs intercept messages from the hardware, and respond to it. Other programs can send messages to other programs, and can just simply send the hardware program's message. It's done in Windows quite often.
These are typically accomplished under Windows through keybd_event(), mouse_event(), SendInput(), or SendMessage().
EDIT: The first three insert data into the keyboard and/or mouse input stream, while SendMessage() will allow you to send a mouse or keyboard event directly to the application.