Home

coclass

In the Component Object Model (COM) and its Interface Description Language (MIDL), a coclass is a type library construct that represents a concrete class that can be instantiated and that implements one or more interfaces. A coclass provides a mapping from a class identifier (CLSIDs) to the interfaces the object supports, and it can specify which interface is the default for activation.

A coclass is declared within a type library or IDL file and is associated with a unique

Activation and usage follow a standard pattern: a client calls a function such as CoCreateInstance with the

In type libraries, coclasses enable designers to describe the capabilities of COM components in a language-

GUID
that
becomes
the
CLSID
used
to
create
instances
at
runtime.
It
lists
the
interfaces
that
the
object
implements,
including
which
interface
is
the
default
for
clients
that
activate
the
object
and
which
interfaces
may
be
exposed
to
automation
or
scripting.
Interfaces
themselves
have
their
own
interface
identifiers
(IIDs),
and
a
coclass
ties
these
together
to
describe
the
concrete
object's
public
surface.
CLSID
of
the
coclass
to
create
an
object.
The
COM
runtime
instantiates
the
object
and
returns
a
pointer
to
one
of
the
supported
interfaces,
typically
the
coclass’s
default
interface.
Clients
may
then
use
QueryInterface
to
obtain
other
interfaces
implemented
by
the
same
object.
and
language-neutral
way.
They
also
relate
to
scenarios
involving
proxies
and
stubs
for
remote
or
aggregated
objects,
and
to
variants
that
support
both
early-bound
and
late-bound
(IDispatch)
access.
Overall,
the
coclass
serves
as
the
concrete
embodiment
of
a
COM
class
within
the
IDL
and
type
library
ecosystem.