OleDraw

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.

WINOLEAPI OleDraw(
IUnknown *pUnk, 
DWORD dwAspect, 
HDC hdcDraw, 
LPCRECT lprcBounds); 

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 content, an icon, a thumbnail, or a printed document. Valid values are taken from the enumeration DVASPECT. See DVASPECT for more information.
  • 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 in which the object should be drawn. This parameter is converted to a RECTL structure and passed to IViewObject::Draw.

Return Values

This function supports the standard return values E_INVALIDARG and E_OUTOFMEMORY, as well as the following:

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.

Remarks

Passing into this function any invalid and, under some circumstances, NULL pointers will result in 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.

Requirements

Runs on Versions Defined in Include Link to
Windows CE OS 2.0 and later Ole2.h   Ole232.lib

Note   This API is part of the complete Windows CE OS package as provided by Microsoft. The functionality of a particular platform is determined by the original equipment manufacturer (OEM) and some devices may not support this API.

See Also

DVASPECT, RECTL

 Last updated on Tuesday, July 13, 2004

© 1992-2000 Microsoft Corporation. All rights reserved.