How can I set the mouse position?

前端 未结 5 1435
谎友^
谎友^ 2021-01-15 03:54

I need to set the position of the mouse on the screen. In some other similar question, it was suggested to use CGDisplayMoveCursorToPoint(CGDirectDisplayID display, CG

5条回答
  •  粉色の甜心
    2021-01-15 04:13

    The real answer to this question is:

    CGMainDisplayID()
    

    https://developer.apple.com/library/mac/documentation/GraphicsImaging/Reference/Quartz_Services_Ref/index.html#//apple_ref/c/func/CGMainDisplayID

    CGDisplayMoveCursorToPoint(CGMainDisplayID(), point);
    

提交回复
热议问题