Condividi tramite


SetFormat Method

Places a data format in the OLE drag-and-drop DataObject. Available at run time only.

oDataObject.SetFormat(nFormat | cFormat)

Parameters

  • nFormat | cFormat
    Specifies the format of the data placed on the DataObject. The following table lists the values for some common data formats with a description of each format. You can also create your own format by specifying a unique character string for cFormat.

    Data format* nFormat| cFormat Description
    CF_TEXT 1 Text format.
    CF_OEMTEXT 7 Text format containing characters in the OEM character set.
    CF_UNICODETEXT 13 Unicode text format, available only under Windows NT 4.0 or later.
    CF_FILES or CF_HDROP 15 A handle that identifies a list of files, such as a set of files dragged from the Windows Explorer.
    CFSTR_OLEVARIANTARRAY "OLE Variant Array" An array. Multiple values can be transferred in a single drag-and-drop operation with this format.

    For example, this format can be used to drag a set of items in a list box to another list box.

    CFSTR_OLEVARIANT "OLE Variant" A variant. All data types in Visual FoxPro are represented as variants. This format can be used to drag and drop Visual FoxPro data without losing the data type.
    CFSTR_VFPSOURCEOBJECT "VFP Source Object" A reference to the Visual FoxPro drag source object.

    * Defined in FOXPRO.H.

Remarks

You can place a data format in the DataObject before placing the corresponding data on the DataObject. If you place a data format in the DataObject without corresponding data and invoke the GetData method in the OLEDragDrop event, the OLESetData event is executed for the drag source. The drag source can then place the data on the DataObject with the SetData method in the OLESetData event.

OLE drag-and-drop performance can be improved by placing just the data formats on the DataObject when a large amount of data is placed on the DataObject, when using data formats that aren't natively supported by Visual FoxPro, or when using a large number of formats.

The SetFormat method can only be executed in the OLEStartDrag and OLESetData events.

See Also

ClearData Method | GetData Method | GetFormat Method | OLE Drag-and-Drop Overview | OLEDragDrop Event | OLESetData Event | OLEStartDrag Event | SetData Method

Applies To: DataObject Object