First of all hello, and thank you for taking a look at my problem.
Let me just give you a little frame on what I was requested to do.
Someone asked me if I could write him a little program for the game "SCUM"
that automatically reloggs him into *his* server after a restart.
For that I have to do three things:
1. Click the OK-Button from the "lost connection to server" prompt
2. Click the "Multiplayer" button
3. Enter the server ip in the "IP-Edit-field" and hit enter
My thought was to make a screenshot from the game window (which I already have)
and then search for the buttons using images.
For the template matching I use opencv.
I have several issues with that:
1. The template matching instantly looses accuracy when the window has different resolutions.
2. The template matching in general does not really work
3. I want to send "mouse events" to the game window, but it shouldn't matter if the window is minimized or not, and I found a function called "SendMessage", but it's not really working:
1 2 3 4 5 6 7 8 9
|
bool mouseClick(HWND hwnd, int x, int y)
{
// some sources said this to be required, but had no explaination why
if (!SetForegroundWindow(hwnd)) return false;
return
SendMessageA(hwnd, WM_LBUTTONDOWN, NULL, MAKELPARAM(x, y)) &&
SendMessageA(hwnd, WM_LBUTTONUP, NULL, MAKELPARAM(x, y))
}
|
Oher ideas I had:
1. Call game functions like in game hacking, but it's risky (Easy Anti Cheat)
2. Just use python which solves the problems I have right now, but other will come up (and I'm better at C++)
Any ideas how to solve at least the SendMessage problem?
I know the other things don't belong to windows, but maybe someone has another idea I could try
thanks in advance ;)