IViewObject2::GetExtent method

Retrieves the size that the specified view object will be drawn on the specified target device.

Syntax

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

Parameters

dwDrawAspect

Requested view of the object whose size is of interest. Possible values are taken from the DVASPECT and DVASPECT2 enumerations. Note that newer objects and containers that support optimized drawing interfaces support the DVASPECT2 enumeration values. Older objects and containers that do not support optimized drawing interfaces may not support DVASPECT2.

lindex

The portion of the object that is of interest. Currently, the only possible value is -1.

ptd

A pointer to the DVTARGETDEVICE structure defining the target device for which the object's size should be returned.

lpsizel

A pointer to where the object's size is returned.

Return Value

This method returns S_OK on success. Other possible return values include the following.

Return code Description
OLE_E_BLANK
An appropriate cache is not available.

Remarks

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

The IOleObject::GetExtent method in the IOleObject interface provides some of the same information as IViewObject2::GetExtent.

This method must return the same size as DVASPECT_CONTENT for all the new aspects in DVASPECT2. IOleObject::GetExtent 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.

Notes to Callers

To prevent the object from being run if it isn't already running, you can call IViewObject2::GetExtent rather than IOleObject::GetExtent to determine the size of the presentation to be drawn.

Requirements

   
Minimum supported client Windows 2000 Professional [desktop apps only]
Minimum supported server Windows 2000 Server [desktop apps only]
Target Platform Windows
Header oleidl.h
DLL Adhocreportingexcelclient.dll

See Also

DVASPECT

DVASPECT2

IOleObject::GetExtent

IViewObject

IViewObject2