ADC Home > Reference Library > Technical Q&As > Carbon > Human Interface Toolbox >

Not Recommended Documentclose button

Important: The information in this document is Not Recommended and should not be used for new development.

Current information on this Reference Library topic can be found here:

How PBDTGetAPPL Chooses Which Copy of an App to Launch

Q How does PBDTGetAPPL() choose the "best" copy of an application to launch? Sometimes the choice PBDTGetAPPL() returns information about a copy of the application that happens to be in the Trash. How can I guarantee that the copy of an application I attempt to launch is not in the Trash?

A PBDTGetAPPL is documented in Inside Macintosh: More Macintosh Toolbox. On page 9-5, it states, "In each call to PBDTGetAPPL, you specify a creator (which is the application's signature) and an index value. An index value of 0 retrieves the "first choice" application--that is, the one with the most recent creation date."

This Inside Macintosh explanation is not really correct. When you specify and creator and pass an index value of 0, PBDTGetAPPL() actually returns information about the LAST copy of the application the Desktop Manager used to update the Desktop database, NOT the copy with the most recent creation date. In other words, PBDTGetAPPL() returns Last-In-First-Out information from the Desktop database.

To avoid launching a copy of the application that is currently in the Trash folder add a check for the application's parent ID. If the "first choice" is in the Trash, then make indexed calls (beginning with an index of 1) to PBDTGetAPPL to get information about all copies of the application and compare the ioAPPLParID and ioTagInfo (creation date) fields to find the copy of the application with the latest creation date that is not currently in the Trash.

[May 14 1996]


Did this document help you?
Yes: Tell us what works for you.
It’s good, but: Report typos, inaccuracies, and so forth.
It wasn’t helpful: Tell us what would have helped.