Platform SDK: Active Directory, ADSI, and Directory Services

Class Icons

The iconic images used to represent a class object can be read from the Display Specifier. Moreover, each class can store multiple icon states. For example, a folder class can have bitmaps for the open, closed, and disabled states. The current implementation allows up to sixteen different icon states per class.

The attribute is named iconPath and can be specified in one of two ways.

state,ICOfilename

or

state,DLLname,resourceID

In this example, the state is an integer with a value between 0 and 15. The value 0 is defined to be the default or "closed" state of the icon. The value 1 is defined to be the "open" state of the icon. The value 2 is the disabled state. The other values are application-defined.

The ICOfilename or DLLname must be the name of a file in the local computer's file search path.

The resourceID is a zero-based index into the DLL's resource fork list of icons.

Adding a Value to the iconPath Property

When you add a value for an icon to iconPath, follow these rules:

  1. Check if an icon for the state intended for the new icon exists. If you want to replace an existing icon value, delete it first using IADs::PutEx method with the lnControlCode parameter set to ADS_PROPERTY_DELETE and the vProp parameter set to the value you want removed.

    Do not use ADS_PROPERTY_CLEAR or ADS_PROPERTY_UPDATE.

  2. Set the state portion of the value to the icon state for the new icon that you want to add.
  3. To add the value, use the IADs::PutEx method with the lnControlCode parameter set to ADS_PROPERTY_APPEND so that the value will be added to the existing values (and, therefore, not overwrite the existing values). Make sure you call IADs::SetInfo to commit the change to the directory.