Share via


coclass macro

This statement describes the globally unique ID (GUID) and the supported interfaces for a Component Object Model (COM).

Syntax

 coclass(
    attributes,
    classname,
    attributes2,
    interfacename
);

Parameters

attributes

The uuid attribute is required on a coclass. This is the same uuid that is registered as a CLSID in the system registration database. The helpstring,helpcontext, version, licensed, version, control, hidden, and appobject attributes are accepted, but not required, before a coclass definition. The appobject attribute makes the functions and properties of the coclass globally available in the type library.

classname

The name by which the common object is known in the type library.

attributes2

Optional attributes for the interface or dispinterface. The source, default, and restricted attributes are accepted on an interface or dispinterface in a coclass.

interfacename

Either an interface declared with the interface keyword, or a dispinterface declared with the dispinterface keyword.

Remarks

[attributes]
coclass classname {
   [attributes2] [interface | dispinterface] interfacename;
};

The Component Object Model defines a class as an implementation that allows QueryInterface between a set of interfaces.

Example

[ uuid(BFB73347-822A-1068-8849-00DD011087E8), version(1.0), helpstring("A class"), helpcontext(2481), appobject]
coclass myapp {
   [source] interface IMydocFuncs;
   dispinterface DMydocFuncs;
};

[uuid 00000000-0000-0000-0000-123456789019] 
coclass test
{
   [restricted] interface ITest;
   interface ITest;
}