OleSetTargetDevice

3.1

  #include <ole.h>    

  OLESTATUS OleSetTargetDevice(lpObject, hotd)    
  LPOLEOBJECT lpObject; /* address of object */
  HGLOBAL hotd; /* handle of OLETARGETDEVICE structure */

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

Parameters

lpObject

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

hotd

Identifies an OLETARGETDEVICE 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 may 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 a linked or embedded object to be formatted correctly for a target device, even when the object 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 OleUpdate function to ensure that the information is sent to the server, so that the server can make the necessary changes to the object's presentation. The client application should call the library to redraw the object if it receives a notification from the server that the object has changed.

A client application uses the OleSetTargetDevice function to change the target device. The client does not need to call OleSetTargetDevice every time a server is opened.