ADC Home > Reference Library > Technical Q&As > Legacy Documents > Carbon >

Legacy Documentclose button

Important: This document is part of the Legacy section of the ADC Reference Library. This information should not be used for new development.

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

Standard File Package


Q: Where does the Standard File Package get its icons?

A: The Standard File Package uses PBDTGetIcon to get icon data from the desktop database. You can observe this by entering the following command in MacsBug to place a break point on the call:

atb _HFSDispatch d0=23

The sample code calls PBDTGetIcon.

static OSErr GetIconHandle(Handle h)
{
   OSErr err;
   short DTrefNum;
   Rect srcRect;
   Str255 volName = "\pMacintosh HD";
   short i;
   IcnInfo ic;
   pb.ioCompletion = NULL;
   pb.ioVRefNum = 0;
   pb.ioNamePtr = volName;
   err= PBDTGetPath(&pb);
   if( err ) return err;
   DTrefNum = pb.ioDTRefNum;
   HLock(h);
   b.ioCompletion = NULL;
   b.ioDTRefNum = DTrefNum;
   b.ioTagInfo = 0L;
   b.ioDTBuffer = *h;
   b.ioDTReqCount = kLarge8BitIconSize; /* ask for the largest */
   b.ioFileCreator = 'ttxt';       /* hard wiring these values */
   b.ioFileType = 'APPL';
   err = PBDTGetIcon(&b,0);
   HUnlock(h);
   return(err);
}

Disclaimer: This code has not been fully tested, so it is provided on an as- is basis only. You are responsible for all testing, if you decide to include it in any of your own code.

[May 01 1995]


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.