Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
peeking for an Apple Event
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

peeking for an Apple Event



I would like to determine if my application was started by the opening of a specific file type.

I have to do this before the main event loop starts so I am trying to peek for the presence of a "open documents" apple event. I use the function FindSpecificEventInQueue to match for a carbon event of class kEventClassAppleEvent and of type kEventAppleEvent and I check that the kEventParamAEEventClass and kEventParamAEEventID parameters are kCoreEventClass and kAEOpenDocuments respectively.

But this is where I am stuck...
I don't know how to get the AppleEvent structure in order to traverse the descriptor tree to determine what files are to be opened.


It seems that the only way to get the AppleEvent from the carbon event is to actually dispatch it using AEProcessAppleEvent. I tried calling AEProcessAppleEvent with the event that I search for in the event queue (without removing it) but I get an noOutstandingHLE error.

Does anyone have any other ideas of how to do this?

Is there any other way to determine what files were opened at startup other than by apple events?

BTW,
I found that I have to kick the event loop to get the initial apple events to appear. Without doing this I don't find any apple events in the queue. Receive the next event without waiting nor removing it:
ReceiveNextEvent(0, NULL, 0.0, false, NULL);
Don't ask how I figured this out. I don't know if this is reliable.
Does anybody know a better (proper) way of getting the apple events to appear?



Thanks in advance, Mark

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Carbon-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden




Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.