1
Obwohl CGEventCreateMouseEvent
nicht in Xcode veraltet 7, erhalte ich FehlerCGEventCreateMouseEvent complie Fehler in Xcode 7
No matching function for call to 'CGEventCreateMouseEvent'
finden Sie den Code in Xcode 6 (SDK OSX 10.10) arbeitete
-(void)sendMouseClick:(CGMouseButton)mouseBtn value:(uint32_t)value
{
int mouseEvent = 0;
if(mouseBtn == kCGMouseButtonLeft && value == 1) //left btn down
{
mouseEvent = kCGEventLeftMouseDown;
}
else if (mouseBtn == kCGMouseButtonLeft && value == 0) //left btn up
{
mouseEvent = kCGEventLeftMouseUp;
}
else if (mouseBtn == kCGMouseButtonRight && value == 1) //Right btn down
{
mouseEvent = kCGEventRightMouseDown;
}
else if (mouseBtn == kCGMouseButtonRight && value == 0) //Right btn up
{
mouseEvent = kCGEventRightMouseUp;
}
if(mouseEvent != 0) // a valid mouse event
{
CGEventRef ourEvent = CGEventCreate(NULL);
NSPoint mouseLoc = CGEventGetLocation(ourEvent); //get current mouse position
CGEventRef mouseClick = CGEventCreateMouseEvent(
NULL,
mouseEvent,
mouseLoc,
mouseBtn
);
CGEventPost(kCGHIDEventTap, mouseClick);
}
}
Ich habe versucht, <CoreGraphics/CGEvent.h>
zu importieren, aber es machte keinen Unterschied. Irgendeine Idee was passiert?