2011-11-07 108 views

回答

0

我的建議是,你檢查VNC的Mac端口如何做到這一點。

1

CGPostMouseEvent已在SnowLeopard中棄用。您可以用類似

CGEventRef mouseDownEv = CGEventCreateMouseEvent (NULL,kCGEventLeftMouseDown,pt,kCGMouseButtonLeft); 
CGEventPost (kCGHIDEventTap, mouseDownEv); 

CGEventRef mouseUpEv = CGEventCreateMouseEvent (NULL,kCGEventLeftMouseUp,pt,kCGMouseButtonLeft); 
CGEventPost (kCGHIDEventTap, mouseUpEv); 

CGEventRef CGEventCreateMouseEvent( 
    CGEventSourceRef source,  // The event source may be taken from another event, or may be NULL. 
    CGEventType mouseType,   // `mouseType' should be one of the mouse event types. 
    CGPoint mouseCursorPosition, // `mouseCursorPosition' should be the position of the mouse cursor in global coordinates. 
    CGMouseButton mouseButton);  // `mouseButton' should be the button that's changing state; 
            // `mouseButton' is ignored unless `mouseType' is one of 
            // `kCGEventOtherMouseDown', `kCGEventOtherMouseDragged', or `kCGEventOtherMouseUp'. 

鼠標按鈕0是鼠標的主要按鈕。 鼠標按鈕1是輔助鼠標按鈕(右)。 鼠標按鈕2是中央按鈕,其餘按鈕按USB設備順序排列。

kCGEventLeftMouseDown 
kCGEventLeftMouseUp 
kCGEventRightMouseDown 
kCGEventRightMouseUp 
kCGEventMouseMoved 
kCGEventLeftMouseDragged 
kCGEventRightMouseDragged 

現在在您的處置。

+0

這很容易!謝謝 :)) – Hlung