Legacy Documentclose button

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

Previous Book Contents Book Index Next

Inside Macintosh: More Macintosh Toolbox /
Chapter 9 - Desktop Manager / Desktop Manager Reference
Routines / Adding to the Desktop Database


PBDTAddIcon

To add an icon definition to the desktop database, use the PBDTAddIcon function.

FUNCTION PBDTAddIcon (paramBlock: DTPBPtr; async: Boolean): OSErr;
paramBlock
A pointer to a desktop parameter block.
async
A Boolean value that specifies asynchronous (TRUE) or synchronous (FALSE) execution.
--> ioCompletionProcPtrA pointer to a completion routine.
\xAE ioResultOSErrThe result code of the function.
-->ioDTRefNumIntegerThe desktop database reference number.
--> ioTagInfoLongIntReserved; must be set to 0.
--> ioDTBufferPtrA pointer to the icon's data.
--> ioDTReqCountLongIntThe size of the icon's bitmap.
--> ioIconTypeSignedByteThe icon type.
--> ioFileCreatorOSTypeThe icon's file creator.
--> ioFileTypeOSTypeThe icon's file type.

DESCRIPTION
The PBDTAddIcon function adds an icon definition to the desktop database specified in ioDTRefNum. You specify the creator and file type that the icon is associated with in the ioFileCreator and ioFileType fields. For the icon type in ioIconType, specify either a constant or a value from the following list.
ConstantValueCorresponding
resource type
Description
kLargeIcon1'ICN#'Large black-and-white icon
with mask
kLarge4BitIcon2'icl4'Large 4-bit color icon
kLarge8BitIcon3'icl8'Large 8-bit color icon
kSmallIcon4'ics#'Small black-and-white icon
with mask
kSmall4BitIcon5'ics4'Small 4-bit color icon
kSmall8BitIcon6'ics8'Small 8-bit color icon

The value you supply in ioDTReqCount is the size in bytes of the buffer that you've allocated for the icon's bitmap pointed to by ioDTBuffer; this value depends on the icon type. Be sure to allocate enough storage for the icon data; 1024 bytes is the largest amount required for any icon in System 7. For the number of bytes in ioDTReqCount, you specify either a constant or a value from the following list.
ConstantValue
(bytes in
bitmap)
Corresponding
resource type
Description
kLargeIconSize256'ICN#'Large black-and-white icon
with mask
kLarge4BitIconSize512'icl4'Large 4-bit color icon
kLarge8BitIconSize1024'icl8'Large 8-bit color icon
kSmallIconSize64'ics#'Small black-and-white icon
with mask
kSmall4BitIconSize128'ics4'Small 4-bit color icon
kSmall8BitIconSize256'ics8'Small 8-bit color icon

You pass a pointer to the icon bitmap in the ioDTBuffer field. You must initialize the ioTagInfo field to 0.

If the database already contains an icon definition for an icon of that type, file type, and file creator, the new definition replaces the old.

RESULT CODES
noErr0No error
ioErr-36I/O error
wPrErr-44Volume is locked through hardware
vLckdErr-46Volume is locked through software
rfNumErr-51Reference number invalid
extFSErr-58External file system--file system identifier is nonzero
afpIconTypeError-5030Sizes of new icon and one it replaces don't match

Previous Book Contents Book Index Next

© Apple Computer, Inc.
6 JUL 1996