ITextRange::CanPaste method (tom.h)

Determines if a data object can be pasted, using a specified format, into the current range.

Syntax

HRESULT CanPaste(
  VARIANT *pVar,
  long    Format,
  long    *pValue
);

Parameters

pVar

Type: VARIANT*

The IDataObject to be pasted. However, the Clipboard contents are checked for pasting if any of the following are true:

  • pVar is null
  • pVar->punkVal is null
  • pVar->vt is not VT_UNKNOWN
  • pVar->punkVal does not return an IDataObject object when queried for one

Format

Type: long

Clipboard format that is used. Zero represents the best format, which usually is RTF, but CF_UNICODETEXT and other formats are also possible. The default value is zero.

pValue

Type: long*

A tomBool value that is tomTrue only if the data object identified by pVar can be pasted, using the specified format, into the range. This parameter can null.

Return value

Type: HRESULT

The method returns the following COM error codes. For more information on COM error codes, see Error Handling in COM.

Return code Description
S_OK
The clipboard contents or IDataObject can be pasted.
S_FALSE
The clipboard contents or IDataObject cannot be pasted.

Requirements

Requirement Value
Minimum supported client Windows Vista [desktop apps only]
Minimum supported server Windows Server 2003 [desktop apps only]
Target Platform Windows
Header tom.h
DLL Msftedit.dll

See also

Conceptual

Copy

ITextRange

Reference

Text Object Model