Home

DISPIDNEWENUM

DISPID_NEWENUM, sometimes written as DISPID_NEWENUM or DISPIDNEWENUM, is the dispatch identifier used in COM automation to access the _NewEnum member of a collection object. The value is defined as -4 in the standard OLE Automation headers. When a client uses IDispatch to interact with a collection, it maps the string "_NewEnum" to this dispatch ID and invokes it with a property get request to obtain an enumerator, typically an IEnumVARIANT.

The obtained enumerator provides the items of the collection one by one, as VARIANT values, enabling language

What distinguishes DISPID_NEWENUM is its role as a standardized hook for enumeration rather than a regular

In practice, developers rarely call DISPID_NEWENUM directly; instead, they rely on the language runtime's automation layer

See also: IDispatch, IEnumVARIANT, VARIANT, DISPID_PROPERTYPUT.

environments
that
host
COM
objects
to
implement
foreach
or
For
Each
looping
constructs.
Languages
such
as
VBScript,
JScript,
and
other
automation-enabled
environments
rely
on
this
convention
to
iterate
over
collections.
property.
Not
all
COM
objects
expose
_NewEnum;
only
those
designed
to
be
enumerable
implement
this
member,
making
the
presence
of
DISPID_NEWENUM
a
compatibility
feature
for
scripting
and
automation
clients.
to
access
the
enumeration
interface.
Understanding
this
dispatch
ID
helps
explain
how
iteration
over
COM
collections
is
implemented
across
diverse
hosts
and
languages.