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. |
This helper function provides a convenient way to draw objects by encapsulating the IViewObject::Drawmethod and other related maintenance functions for the drawing rectangle.
Syntax
WINOLEAPIOleDraw( IUnknown* pUnk, DWORD dwAspect, HDC hdcDraw, LPCRECT lprcBounds ); |
Parameters
- pUnk
-
[in] Pointer to the IUnknowninterface 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.
- Content
- hdcDraw
-
[in] Handle to the device context (DC) on which to draw.
Cannot be a metafile device context.
Return Value
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 IViewObjectinterface. |
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 OleDrawhelper function calls the QueryInterfacemethod for the object specified ( pUnk), asking for an IViewObjectinterface on that object. Then, OleDrawconverts the RECTstructure to a RECTLstructure, and calls IViewObject::Drawas follows.
Copy Code | |
---|---|
lpViewObj->Draw(dwAspect,-1,0,0,0,hdcDraw,&rectl,0,0,0); |
Do not use OleDrawto draw into a metafile because it does not specify the lprcWBoundsparameter required for drawing into metafiles.
To determine whether the platform supports this function, see Determining Supported COM APIs.
Requirements
Header | ole2.h |
Library | ole32.lib |
Windows Embedded CE | Windows CE 2.0 and later |
Windows Mobile | Windows Mobile Version 5.0 and later |
See Also
Reference
Automation FunctionsIViewObject::Draw
DVASPECT
IUnknown
DVASPECT
IViewObject
IUnknown::QueryInterface
Concepts
Determining Supported COM APIsOther Resources
RECTLRECT