I've done this before, but with this specific button, it doesn't work!
If I click the button manually it creates a new window (mini-map): Image
/////// But Programmatically I can see the animation on the button as if it gets clicked gif,
But the window (mini-map) doesn't show up.
int x = 9, y = 8;
IntPtr lParam = (IntPtr)((y << 16) | x);
WinAPIs.PostMessage(button, WinAPIs.WM_LBUTTONDOWN, (IntPtr)0x01, lParam);
WinAPIs.PostMessage(button, WinAPIs.WM_LBUTTONUP, IntPtr.Zero, lParam);
The mini-map is created only if the mouse is over the button when my code sends the messages.
Here's a 10-sec video on YT: Video,
Notice: In the video, I didn't click the button with the mouse, I've just hovered it.
UPDATE1: Spy++ Messages Image
UPDATE2: the game is using GetCursorPos and WindowFromPoint to get the handle of the window under the cursor and compare it with the button's handle, I need to figure out how to hook WindowFromPoint to send the button's handle even if the game is in the background.