I've come a long way since I first posted in this C++ forum. Understand a whole lot more now about C++ and I feel like I want to get started on remaking this PokeMMO bot I made in AuotIt. I've got a few links open for code caving (To read values in game) and right now I'm starting on something simple, just moving (left, right, up, down) but I'm having problems getting started...
MSDN isn't very good with tutorials and googling has given very small fruit.
So what I need to get started
- How to send keys (I would also like to know how to send strings, like have the the program type out "Hello World!" to notepad instead of printing it to the cmd)
- Activate windows
So far I've gotten this but INPUT seems rather tedious and I'll need to define every single key. Plus I may want to make it so the bot will work minimized and send the key to the window but still be able to do other things (For now having the game as the active window is okay).
Code:
#include <windows.h>
#include <winuser.h>
using namespace std;
void main()
{
INPUT left, right, up, down;
left.type = INPUT_KEYBOARD;
left.ki.wScan = 0;
left.ki.time = 0;
left.ki.dwExtraInfo = 0;
left.ki.wVk = 0x41; // Yes I know 0x41 is not "left" it's 'a'
left.ki.dwFlags = 0;
HWND WNDNotepad = FindWindow(0, TEXT("Notepad"));
while (!(WNDNotepad)){
SendInput(1, &left, sizeof(INPUT));
Sleep(500);
}
}
And a few MSDN links I've got open related to the send keys
And
this tutorial has everything I need but it's kind of vague when the user explains the full function of sending a key. From here I'm probably going to spend the day tomorrow reading about code caving. Probably start with something simple like Mine Sweeper idk lol