F
F
FeNUMe2021-10-16 12:37:17
API
FeNUMe, 2021-10-16 12:37:17

Game on Unity partially ignores messages via winapi, is it possible to fix it?

In general, I'm trying to automate some processes in the game by sending system messages to the window. Now I use ahk, but I tried from python with the same result. Messages for closing the window, pressing keyboard keys are processed perfectly and without problems, but when it comes to mouse clicks at given coordinates, for some reason, the click occurs with the current cursor coordinates.
Code example

x = 920
y = 110
lParam := x & 0xFFFF | (y & 0xFFFF) << 16 
PostMessage, 0x200, , %lParam%,, ahk_exe game.exe                ;WM_MOUSEMOVE	
PostMessage, 0x201, 0x4 | 0x1, %lParam%,, ahk_exe game.exe ;WM_LBUTTONDOWN нажимаем шифт+лкм
PostMessage, 0x202, 0x4, %lParam%,, ahk_exe game.exe          ;WM_LBUTTONUP


Through Windows Detective, I checked that the game window receives messages, the parameters are correct and completely match the messages that the window receives if you make a real mouse click.
Tried to add additional messages like WM_ACTIVATE and WM_SETCURSOR - doesn't help.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question