[Mono-osx] Using AppleEvents

Michael Hutchinson m.j.hutchinson at gmail.com
Fri Feb 3 20:09:23 UTC 2012


On 30 January 2012 14:36, tlapse <tlapse at gmail.com> wrote:
> Well, I am trying to get rid of the Carbon code.
>
> I'm looking for a way to use AppleEvents, but there doesn't seem to be a way
> from within MonoMac

If you want to use AppleEvents, you cannot completely remove the
Carbon dependency. Some of parts of Cocoa are built on top of
low-level Carbon APIs - e.g. AppleEvents. If you want to access those
APIs you must use Carbon. The Cocoa class NSAppleEventDescriptor is
actually a wrapper over Carbon's AEDesc, and even provides a way to
access the AEDesc. The Apple docs for NSAppleEventDescriptor
explicitly mention using the Carbon function AESend to send Apple
events as it is not possible from Cocoa.

There is no wrapper in MonoMac for the Carbon Event Manager APIs, so
you'd have to P/Invoke them manually. You can find some P/Invokes
here: https://github.com/mono/monodevelop/blob/master/main/src/addins/MacPlatform/MacInterop/AppleEvent.cs

-- 
Michael Hutchinson
http://mjhutchinson.com


More information about the Mono-osx mailing list