Interceptor icon indicating copy to clipboard operation
Interceptor copied to clipboard

About does not function reliably and often moves the mouse in unpredictable vectors.

Open tomby opened this issue 8 years ago • 5 comments

I had a deep study on C++ sample source and found all the location(mean x,y) changed to device location such as int x = static_cast((0xFFFF * (center.x + position.x)) / screen_width); This means the X and y which is passed to the two function MoveMouseTo and MoveMouseBy are not correctly or unclear. So I did some change, it works perfectly. here is my change: Point point = ConvertDevicePoint(x, y); mouseStroke.X = point.X; mouseStroke.Y = point.Y; The function ConvertDevicePoint code is the following: private static Point ConvertDevicePoint(int x,int y) { int SH = Screen.PrimaryScreen.Bounds.Height; int SW = Screen.PrimaryScreen.Bounds.Width; return new Point(0xFFFF * x / SW, 0xFFFF * y / SH); } Then it works.

Thanks a lot for your code and help me a lot.

tomby avatar Nov 05 '17 09:11 tomby

You succeed to simulate left and right click? The keyboard works great in contrast to the mouse that doesn't work at all.

barak1413 avatar Nov 06 '17 11:11 barak1413

Yes,it works correctly by the way aboved

tomby avatar Nov 07 '17 14:11 tomby

I try your solution but, it still move the mouse to wrong location, for example: I have 2 monitors 1920x1080, if I use MoveMouseto(1300,700) - that is definitely inside the 1st monitor but it move the mouse to 2nd monitor and even wrong coordinate rather than 1300, 700.

hoanglong241231 avatar Jul 04 '20 08:07 hoanglong241231

Im repying to aswer my own question. If you have 2 monitors that have same resolution and their position (in side window display setting) is placed same row, like 2 x 1920*1080 You may want to try to devide the 0xFFFF by 2. if 2 monitor is placed same row then in the X, devide 0xFFFF by 2, and keep 0xFFFF of the Y. if 2 monitor is placed same column then in the Y, devide 0xFFFF by 2, and keep 0xFFFF of the X. You may want to make further maths if your case is 2 monitors have different res, or more than 2 monitors,... etc

hoanglong241231 avatar Jul 04 '20 13:07 hoanglong241231

Im repying to aswer my own question. If you have 2 monitors that have same resolution and their position (in side window display setting) is placed same row, like 2 x 1920*1080 You may want to try to devide the 0xFFFF by 2. if 2 monitor is placed same row then in the X, devide 0xFFFF by 2, and keep 0xFFFF of the Y. if 2 monitor is placed same column then in the Y, devide 0xFFFF by 2, and keep 0xFFFF of the X. You may want to make further maths if your case is 2 monitors have different res, or more than 2 monitors,... etc

It's up to your main monitor, please make sure the master and slave monitor is correct.

tomby avatar Jul 05 '20 02:07 tomby