Important:
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.
A version of this page is also available for
4/8/2010

This method returns the size that the specified view object will be drawn on the specified target device.

Syntax

HRESULT GetExtent(
  DWORD 
dwAspect,
  LONG 
lindex,
  DVTARGETDEVICE 
ptd,
  LPSIZEL 
lpsizel
);

Parameters

dwAspect

[in] Requested view of the object whose size is of interest. Valid values are taken from the enumerations DVASPECTand from DVASPECT2.

Newer objects and containers that support optimized drawing interfaces support the DVASPECT2enumeration values.

Older objects and containers that do not support optimized drawing interfaces may not support DVASPECT2.

lindex

[in] Portion of the object that is of interest. Currently only -1 is valid.

ptd

[in] Pointer to the DVTARGETDEVICEstructure defining the target device for which the object's size should be returned.

lpsizel

[out] Pointer to where the object's size is returned.

Return Value

This method supports the standard return value E_OUTOFMEMORY.

If the method returns S_OK, the object's extent was successfully returned.

If OLE_E_BLANK is returned, an appropriate cache is not available.

Remarks

The OLE-provided implementation of IViewObject2::GetExtentsearches the cache for the size of the view object.

The IOleObject::GetExtentmethod provides some of the same information as IViewObject2::GetExtent.

Note:
This method must return the same size as DVASPECT_CONTENT for all the new aspects in DVASPECT2. The IOleObject::GetExtentmethod must do the same thing.

If one of the new aspects is requested in dwAspect, this method can either fail or return the same rectangle as for the DVASPECT_CONTENT aspect.

Note to Callers

To prevent the object from being run if it is not already running, you can call IViewObject2::GetExtentrather than IOleObject::GetExtentto determine the size of the presentation to be drawn.

To determine whether the platform supports this interface, see Determining Supported COM APIs.

Requirements

Header Oleidl.h, oleidl.idl
Library ole32.lib, uuid.lib
Windows Embedded CE Windows CE 3.0 and later
Windows Mobile Windows Mobile Version 5.0 and later

See Also