Compartilhar via


IViewObject

A version of this page is also available for

Windows Embedded CE 6.0 R3

4/8/2010

This interface enables an object to display itself directly without passing a data object to the caller. In addition, this interface can create and manage a connection with an advise sink so the caller can be notified of changes in the view object.

The IViewObject interface enables an object to display itself directly without passing a data object to the caller. In addition, this interface can create and manage a connection with an advise sink so the caller can be notified of changes in the view object.

The caller can request specific representations and specific target devices. For example, a caller can ask for either an object's content or an iconic representation.

Also, the caller can ask the object to compose a picture for a target device that is independent of the drawing device context. As a result, the picture can be composed for one target device and drawn on another device context.

For example, to provide a print preview operation, you can compose the drawing for a printer target device but actually draw the representation on the display.

The IViewObject interface is similar to IDataObject, except that IViewObject places a representation of the data onto a device context while IDataObject places the representation onto a transfer medium.

Unlike most other interfaces, IViewObject cannot be marshaled to another process. This is because device contexts are only effective in the context of one process.

When to Implement

Object handlers and in-process servers that manage their own presentations implement IViewObject for use by compound document containers. OLE provides an IViewObject implementation for its default object handler's cache.

When to Use

You call IViewObject from a container application if you need to draw a contained object on a specific device context. For example, if you want to print the object to a printer, you call the IViewObject::Draw method.

Methods

The following table shows the methods for this interface in alphabetical order. Like all COM interfaces, this interface inherits the methods for the IUnknown interface.

Method Description

IViewObject::Draw

This method draws a representation of an object onto the specified device context.

IViewObject::Freeze

This method freezes a certain aspect of the object's presentation so that it does not change until the Unfreeze method is called.

IViewObject::GetAdvise

This method retrieves the existing advisory connection on the object if there is one and returns the parameters used in the most recent call to the SetAdvise method.

IViewObject::GetColorSet

This method returns the logical palette that the object uses for drawing in its Draw method with the corresponding parameters.

IViewObject::SetAdvise

This method establishes a connection between the view object and an advise sink so that the advise sink can be notified about changes in the object's view.

IViewObject::Unfreeze

This method releases a previously frozen drawing.

Remarks

To determine whether the platform supports this interface, see Determining Supported COM APIs.

Requirements

Header Oleidl.h, oleidl.idl
Library oleaut32.lib, uuid.lib
Windows Embedded CE Windows CE 2.0 and later
Windows Mobile Windows Mobile Version 5.0 and later

See Also

Reference

OLE Interfaces
IDataObject
IUnknown

Concepts

Determining Supported COM APIs