I've installed a Apple Event handler for URL's in my app:
OSStatus e = AEInstallEventHandler( kInternetEventClass,
kAEGetURL,
NewAEEventHandlerUPP(AppleEventProc),
(SRefCon)this,
false);
And that works if my application is running. However if my app is NOT running, clicking a URL in a browser starts the application but no Apple Event is received on my handler. My call to AEInstallEventHandler is during my app's startup phase, before it reaches the message loop. It's not the very first thing I do, but not too far off it. (Obviously I've setup the plist correctly, as I'm getting events while running)
Any ideas on how to get this working?
Interestingly when Chrome starts my to handle a mailto URL it passes "-psn_0_5100765" on the command line. Which doesn't mean anything to me, does anyone know what it's trying to tell me?
Note: I've setup Apple Event debugging and run it again. I'm definitely getting sent a GURL event on startup, after I have installed the callback handler. However I still can't work out why my callback is not called with that Event.
-psn_0_5100765
looks like aProcessSerialNumber
, which is an older (pre-Carbon era) Mac equivalent of a process ID (with caveats.) I suspect0
is the highlong
of the PSN, and5100765
is the lowlong
. It's presumably the PSN of the calling Chrome tab. – Vistula