Home

DISPIDs

DISPIDs, or dispatch identifiers, are integer identifiers used in Component Object Model (COM) automation to identify members of an interface that supports IDispatch. They enable late binding by letting clients invoke methods or access properties without compile-time knowledge of the interface.

In practice, a scripting or automation client calls IDispatch::GetIDsOfNames to map a member name (such as a

DISPIDs can be assigned in two ways. They may be automatically assigned by a type library when

If an object does not expose IDispatch (for example, a purely vtable-bound interface), DISPIDs are not used.

method
or
property
name)
to
its
corresponding_DISPID,
and
then
uses
IDispatch::Invoke
with
that
DISPID
to
call
the
member
or
read/write
a
property.
This
mechanism
supports
dynamic
discovery
and
invocation
of
members
at
runtime,
which
is
essential
for
languages
like
VBScript,
VBA,
and
JavaScript
in
Windows
environments.
the
interface
is
described
in
IDL
or
in
the
type
library
itself,
or
they
can
be
explicitly
specified
in
the
interface
definition
using
attributes
such
as
[dispid(n)].
The
values
are
stable
for
a
given
type
library,
so
clients
relying
on
those
values
will
continue
to
work
as
long
as
the
library
is
unchanged.
Some
DISPIDs
are
reserved
for
standard
purposes,
such
as
DISPID_VALUE
(often
0)
for
the
default
member,
DISPID_PROPERTYPUT
(-3)
for
property
assignment,
and
DISPID_NEWENUM
(-4)
for
enumerators.
Changes
to
DISPIDs
can
affect
compatibility
with
automation
clients,
so
versioning
and
type-library
management
are
important
considerations
in
COM
development.