Share via


Clone Method

Clone Method

Creates a duplicate InkDisp, InkDrawingAttributes, or InkRecognizerContext object.

Declaration

[C++]

HRESULT Clone(
    [out, retval] IInkDisp **Ink
);

HRESULT Clone(
    [out, retval] IInkDrawingAttributes **DrawingAttributes
);

HRESULT Clone(
    [out, retval] IInkRecognizerContext **RecognizerContext
);

[Microsoft® Visual Basic® 6.0]

Public Function Clone() As InkDisp

Public Function Clone() As InkDrawingAttributes

Public Function Clone() As InkRecognizerContext

Parameters

Ink

Returns the newly created InkDisp object.

DrawingAttributes

Returns the newly created InkDrawingAttributes object.

RecognizerContext

Returns the newly created InkRecognizerContext object.

Return Value

HRESULT value Description
S_OK Success.
E_OUTOFMEMORY Cannot allocate memory to complete the operation.
E_FAIL An unspecified error occurred.
E_POINTER A parameter contained an invalid pointer.
E_INK_EXCEPTION An exception occurred inside the method.
REGDB_CLASSNOTREG The InkDisp object was not registered.
E_UNEXPECTED Unexpected parameter or property type.

Remarks

The Clone method is defined for the InkDisp, InkDrawingAttributes, and InkRecognizerContext objects. The Clone method returns an exact copy of the original object.

In most scenarios, the duplicate object is an exact copy of the original object, but no relation between the two objects exists. See the remarks section of this topic for details on exceptions to this.

InkDisp object: The only scenario in which the duplicate InkDisp object is not an exact copy of the original object is when a dirty InkDisp object is cloned. In this case, the duplicate InkDisp object's Dirty property is False. All other properties of the cloned InkDisp object are exact copies.

InkDrawingAttributes object: Typically, you clone a master copy of the drawingattributes, modify one or more of the attributes, and call the ModifyDrawingAttributes method to use the modified drawing attributes.

InkRecognizerContext object: This method returns a copy of the original InkRecognizerContext that contains the same settings as the original, but does not include the recognition results, if any. The settings that are copied include the recognition guide, character Autocomplete mode, a reference to the original InkDisp, and all properties that improve the recognition results, such as the Factoid property and RecognitionFlags property.

Example

[Visual Basic 6.0]

This Visual Basic 6.0 example creates a clone of the InkDrawingAttributes of a IInkStrokeDisp object.

        Dim theClone As InkDrawingAttributes
Set theClone = theStroke.DrawingAttributes.Clone

Applies To