IDesignerToolbox::GetControlsInUse

Reports the class IDs of ActiveX controls that are currently hosted on the designer.

HRESULT GetControlsInUse (
   DWORD *pcControls,
   CLSID **prgClsid
);

Parameters

pcControls

[out] Pointer to the number of elements in prgClsid.

prgClsid

[out] Array of CLSID values.

Return Values

The designer returns one of the following values:

Return Value Meaning
S_OK Success.
Other statuses Errors.

Comments

The designer implements this method.

The host calls IDesignerToolbox::GetControlsInUse to find out which ActiveX controls are currently hosted on the designer.

In prgClsid, the designer returns an array of CLSID values for the ActiveX controls. In pcControls, the designer returns a pointer to the number of controls, that is, the length of the array. If the designer contains more than one instance of the same control class (such as multiple instances of the same button), the CLSID of the control should appear only once in the array.

The designer should use CoTaskMemAlloc to allocate the array. The host frees the array with CoTaskMemFree.

Example

The following code fragment calls a local routine, GatherClassIdsFromList, which traverses an internal list of data structures to gather information about the controls hosted on the designer.

MyDesigner::GetControlsInUse(DWORD * pcControls, CLSID **prgClsids)
{
   ULONG cClsids;
   rgClsids = new CLSID[m_cControlClasses];

   //Traverse the list of control class data structures, counting
   // the class ids and returning them in an array.
   GatherClassIdsFromList(ControlClasses, &rgClsids, &cClsids);

   *prgClsids = rgClsids;
   *pcControls = cClsids;
   return S_OK;
}