How can I simulate mouse movement by c++ API?

I want to make a remote controller which can receive player input (like key input or mouse click) info from another computer(by custom json perhaps), then it can do the same thing as the player do to this computer.

And I found InputKey() and SetMouseLocation() in APlayerController class, but MouseX and MouseY axis values always return 0.It seems SetMouseLocation() only effect the mouse position on screen. I found InputAxis() , but this API will return false when key is MouseX or MouseY.

So what should I do to control mouse move?

In the end, I decided to use win32 API SendInput() to solve this problem. But this may only work on Windows

If you have multiple programs(UE4 games), how do you send messages to each process individually. As far as I know, SendInput() cannot be assigned to the specified program (window)