I’ve got a problem with simulating in game’s process this action:
– mouse_down
– mouse_move
– mouse_up
When I do it manually, that’s the spy++ output:

mouse_down:

mouse_move:

mouse_up:

So I’ve tried to simulate that with below code start x,y: (618,392) final x,y: (618,432) but It’s not working.
uint Iparm = makeDWord((ushort)x, (ushort)y);
IntPtr xd = new IntPtr(Iparm);
uint Iparm2 = makeDWord((ushort)x2, (ushort)y2);
IntPtr xd2 = new IntPtr(Iparm2);
SendMessage(UltraBot.p, (uint)0x201, (IntPtr)0x1, xd); // down button (start x,y)
SendMessage(UltraBot.p, (uint)0x200, (IntPtr)0x1, xd2); // move (final x,y)
SendMessage(UltraBot.p, (uint)0x202, (IntPtr)0x0, xd2); // up button (final x,y)
Here’s the spy++ output after using the code:

I don’t really know why it’s not working. I’ve been using this way to simulate keys for some time, actions like: ctrl+q, mouse clicks and so werent any problem. What’s more, IT WORKED FOR ME ONCE, but just once. I’ve stuck in here. Thanks for any help 🙂
You cannot simulate mouse input by sending mouse messages (such as
WM_LBUTTONDOWNandWM_MOUSEMOVE) using theSendMessagefunction.Yes, that’s what it looks like is happening when you monitor the messages with Spy++, but there’s a lot more going on behind the scenes.
To simulate mouse or keyboard input properly, you need to use the
SendInputfunction. The P/Invoke declaration to call it from C# looks like this: