次の方法で共有


CanPaste Method

CanPaste Method

Indicates whether the IDataObject Leave Site can be converted to an InkDisp object.

Declaration

[C++]

HRESULT CanPaste (
    [in, optional, defaultvalue(0)] IDataObject* dataObject,
    [out, retval] VARIANT_BOOL* CanPaste
);

[Microsoft® Visual Basic® 6.0]

Public Function CanPaste( _
    [dataObject As IDataObject] _
) As Boolean

Parameters

dataObject

[in, optional] Specifies the IDataObject Leave Site to inspect. The default value is NULL, which means the data object on the Clipboard is used.

Note: In Visual Basic 6.0, this parameter cannot be omitted if late binding is used. Instead, the default value of Nothing must be explicitly specified.

CanPaste

True if the data object can be converted to an InkDisp object; otherwise, False.

Return Value

HRESULT value Description
S_OK Success.
E_POINTER A parameter contained an invalid pointer.
E_INK_EXCEPTION An exception occurred inside the method.

Remarks

If the supplied IDataObject Leave Site is NULL, then the data object on the Clipboard is used.

Example

[Visual Basic 6.0]

This Visual Basic 6.0 example shows using the forms activate method to enable or disable the paste command on the edit menu based on whether the Clipboard contains something that can be pasted into the ink in the InkCollector object, theInkCollector.

        Private Sub Form_Activate()
    MenuEditPaste.Enabled = theInkCollector.Ink.CanPaste
End Sub

Applies To