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
The following table shows the HRESULT values that can be returned by this function.
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 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.
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
IViewObject::Draw | DVASPECT | RECTL | IUnknown | DVASPECT | RECT | IViewObject | QueryInterface | Determining Supported COM APIs
Last updated on Wednesday, April 13, 2005
© 2005 Microsoft Corporation. All rights reserved.