OleDraw

The OleDraw helper function can be used to draw objects more easily. You can use it instead of calling IViewObject::Draw directly.

STDAPI OleDraw(

IUnknown * pUnk,
//Points to the view object to be drawn
DWORD dwAspect,
//Specifies how the object is to be represented
HDC hdcDraw,
//Identifies the device context on which to draw
LPCRECT lprcBounds
//Specifies the rectangle in which the object is drawn
);

Parameters

pUnk

Points to the view object that is to be drawn.

dwAspect

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

Specifies the device context on which to draw. Cannot be a metafile device context.

lprcBounds

Points 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

S_OK

Indicates object was successfully drawn.

E_INVALIDARG

Indicates one or more arguments are invalid.

E_OUTOFMEMORY

Indicates ran out of memory.

OLE_E_BLANK

Indicates there is no data to draw from.

E_ABORT

Indicates the draw operation was aborted.

VIEW_E_DRAW

Indicates an error occurred in drawing.

OLE_E_INVALIDRECT

Indicates the rectangle is invalid.

DV_E_NOIVIEWOBJECT

Indicates the object doesn't support the IViewObject interface.

Comments

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.

See Also

IViewObject::Draw

Software for developers
Delphi Components
.Net Components
Software for Android Developers
More information resources
MegaDetailed.Net
Unix Manual Pages
Delphi Examples
Databases for Amazon shops developers
Amazon Categories Database
Browse Nodes Database