Microsoft DirectX 9.0


The EnumOverlayZOrders method enumerates the overlays on the specified destination. The overlays can be enumerated in front-to-back or back-to-front order.


HRESULT EnumOverlayZOrders(
  DWORD dwFlags,
  LPVOID lpContext,



One of the following flags.

Value Description
DDENUMOVERLAYZ_BACKTOFRONT Enumerates overlays back-to-front.
DDENUMOVERLAYZ_FRONTTOBACK Enumerates overlays front-to-back.


Points to the user-defined context that will be passed to the callback for each overlay surface.


Points to the callback function that will be called for each overlay that is being overlayed on this surface. See Remarks.

Return Values

Value Description
DD_OK The method succeeded.
DDERR_INVALIDOBJECT DirectDraw received a pointer that was an invalid DirectDraw object.
DDERR_INVALIDPARAMS One or more of the input parameters is invalid.


The callback function passed as lpEnumCallback must have the following syntax:

lpEnumSurfacesCallback(LPDIRECTDRAWSURFACE lpDDSurface,
   LPDDSURFACEDESC pDDSurfaceDesc, LPVOID lpContext);

The lpDDSurface parameter points to the surface that is overlayed on this surface.

The lpDDSurfaceDesc parameter points to a DDSURFACEDESC structure that describes the overlayed surface.

The lpContext parameter contains the value that was passed in the lpContext parameter of EnumOverlayZOrders.

The callback function should return one of the following values:

Value Description
DDENUMRET_OK Continue the enumeration.
DDENUMRET_CANCEL Stop the enumeration.

See Also