When an object has been loaded and, if necessary, brought up-to-date, the object can be displayed or printed with the container document. To display an object, the client application should set up the device context and bounding rectangle (ensuring that they use the same mapping mode) and then call the OleDraw function. The client application can use the OleQueryBounds function to retrieve the size of the bounding rectangle on the target device.
Note An object handler can be used to draw an object. If an object-handler exists for an object, the call to the OleDraw function is received and processed by the object handler. If there is no object handler, the client DLL uses the object's presentation data to display or print it. For more information on object handlers, see Chapter 6, "Implementing Object Handlers."
If the presentation data for an object is a metafile, the library periodically sends an OLE_QUERY_PAINT notification to the client application's callback function while drawing the object. If the callback function returns FALSE, the OleDraw function returns immediately and the drawing is ended. A client application could also use the OLE_QUERY_PAINT notification to take some actions within the callback function and then return TRUE to indicate that drawing should continue. Any actions the client application takes at this time should not interfere with the drawing operation; for example, the client application should not scroll the window.
If the target device for an object changes (for example, when the user changes printers), the client application should call the OleSetTargetDevice function. The client application should also call OleSetTargetDevice whenever an object is created or loaded.
If the size of the presentation rectangle for the object changes—for example, through action by the user—the client application should call the OleSetBounds function. After calling OleSetBounds, the client application should call the OleUpdate function to update the object and then OleDraw to redisplay it.