Hello,
I'm writing a simple pixel bot for personal use, and was wondering if theres any way to consistently use SendMessage for sending input based on pixels?
I'm trying to do simple stuff like
Code:
keybd_event(0x38, 0x45, KEYEVENTF_EXTENDEDKEY | 0, 0);Sleep(15);
keybd_event(0x38, 0x45, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, 0);
Only I'd like to use SendMessage rather than keybd_event, because I can then do other stuff while the pixelbot is running.
I've tried using this
Code:
HWND hWnd = FindWindow(NULL, "World of Warcraft");
SendMessage(hWnd, WM_KEYDOWN, VK_SPACE, NULL);
Sleep(1500);
SendMessage(hWnd, WM_KEYUP, VK_SPACE, NULL);
but it works really inconsistently. Today it might work, tomorrow it might not, it changes from time to time when I open WoW.exe
I've come a little closer, and got it to work when I set the handle in SendMessage myself. Is there a smart way for me to find the window handle, because FindWindow doesnt find the right one it seems.