OleSetTargetDevice

  OLESTATUS OleSetTargetDevice(lpObject, hTargetDevice)    
  LPOLEOBJECT lpObject; /* pointer to object */
  HGLOBAL hTargetDevice; /* handle of target device */

The OleSetTargetDevice function specifies the target output device for an object.

Parameters

lpObject

Points to the object for which a target device is specified.

hTargetDevice

Identifies a StdTargetDevice memory structure that describes the target device for the object.

Return Value

The return value is OLE_OK if the function is successful. Otherwise, it is an error value, which can be one of the following:

OLE_BUSY
OLE_ERROR_MEMORY
OLE_ERROR_OBJECT
OLE_ERROR_STATIC
OLE_WAIT_FOR_RELEASE

Comments

The OleSetTargetDevice function allows an object to be formatted correctly for a target device even when it is rendered on a different device. A client application should call this function whenever the target device changes, so that servers can be notified to change the rendering of the object, if necessary. The client application should call the library to redraw the object if it receives a notification from the server that the object has changed.

The StdTargetDevice structure accepts information about the target device that the client is using. The information is in binary format, interpreted as the following structure. (Offsets are relative to the start of the data array.)

struct {

WORD deviceNameOffset;

WORD driverNameOffset;

WORD portNameOffset;

WORD extDevModeOffset;

WORD extDevModeSize;

WORD environmentOffset;

WORD environmentSize;

BYTE data[];

} StdTargetDevice;