Partager via


OleDraw (Windows CE 5.0)

Send Feedback

This helper function provides a convenient way to draw objects by encapsulating the IViewObject::Draw method and other related maintenance functions for the drawing rectangle.

WINOLEAPIOleDraw(IUnknown* pUnk,DWORDdwAspect,HDChdcDraw,LPCRECTlprcBounds);

Parameters

  • pUnk
    [in] Pointer to the IUnknown interface on the view object that is to be drawn.

  • dwAspect
    [in] Specifies how the object is to be represented.

    Representations include the following:

    • Content
    • An icon
    • A thumbnail
    • A printed document

    Valid values are taken from the enumeration DVASPECT. For more information, see DVASPECT.

  • hdcDraw
    [in] Handle to the device context (DC) on which to draw.

    Cannot be a metafile device context.

  • lprcBounds
    [in] Long pointer to a RECT structure specifying the rectangle where the object should be drawn.

    This parameter is converted to a RECTL structure and passed to IViewObject::Draw.

Return Values

The following HRESULT values can be returned.

Value Description
S_OK Object was successfully drawn.
OLE_E_BLANK No data to draw from.
E_ABORT The draw operation was aborted.
VIEW_E_DRAW An error occurred in drawing.
OLE_E_INVALIDRECT The rectangle is invalid.
DV_E_NOIVIEWOBJECT The object does not support the IViewObject interface.
E_INVALIDARG The function has failed.
E_OUTOFMEMORY The function has failed.

Remarks

Passing invalid (and under some circumstances NULL) pointers into this function causes an unexpected termination of the application.

The OleDraw helper function calls the QueryInterface method for the object specified (pUnk), asking for an IViewObject interface on that object. Then, OleDraw converts the RECT structure to a RECTL structure, and calls IViewObject::Draw as follows.

lpViewObj->Draw(dwAspect,-1,0,0,0,hdcDraw,&rectl,0,0,0); 

Do not use OleDraw to draw into a metafile because it does not specify the lprcWBounds parameter required for drawing into metafiles.

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

Requirements

OS Versions: Windows CE 2.0 and later.
Header: Ole2.h.
Link Library: Ole32.lib.

See Also

Automation Functions | IViewObject::Draw | DVASPECT | RECTL | IUnknown | DVASPECT | RECT | IViewObject | QueryInterface | Determining Supported COM APIs

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.