9.7.1 OleSetBounds

OLESTATUS OleSetBounds(lpObject, lpBounds)

LPOLEOBJECT lpObject;

const RECT FAR* lpBounds;

The OleSetBounds function sets the coordinates of the bounding rectangle for the specified object on the target device.

Parameter Description

lpObject Points to the object for which the bounding rectangle is set.
lpBounds Points to a RECT structure containing the coordinates of the bounding rectangle. The coordinates are specified in MM_HIMETRIC units. Neither the width nor height of an object should exceed 32,767 MM_HIMETRIC units.

The OleSetBounds function is ignored for linked objects, because the size of a linked object is determined by the source document for the link.

A client application uses the OleSetBounds function to change the bounding rectangle. The client does not need to call OleSetBounds every time a server is opened.

The bounding rectangle specified in the OleSetBounds function does not necessarily have the same dimensions as the rectangle specified in the call to the OleDraw function. These dimensions may be different because of the view scaling used by the container application. An application can use OleSetBounds to cause the server to reformat the picture to fit the rectangle more closely.

In the MM_HIMETRIC mapping mode, the positive y-direction is up.

The return value is OLE_OK if successful; otherwise, it could be one of the following:

OLE_BUSY
OLE_ERROR_MEMORY
OLE_ERROR_OBJECT
OLE_WAIT_FOR_RELEASE

The OleSetBounds function returns OLE_ERROR_OBJECT when it is called for a linked object.

See AlsoOleDraw, OleQueryBounds, SetMapMode, RECT