Compartir a través de


SetFormat Method

Places a data format in the OLE DataObject object. Available at run time only.

You can call the SetFormat method in the OLEStartDrag and OLESetData events.

oDataObject.SetFormat(nFormat | cFormat)

Parameters

  • nFormat| cFormat
    Specifies the format of the data placed on the DataObject object. You can also create your own format by specifying a unique character string for cFormat.

    The following table lists values for some common data formats with a description of each format.

    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.

    Note

    Available only for versions of Visual FoxPro running on 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

    Applies To: DataObject Object

    You can place a data format in the DataObject object before placing the corresponding data on the DataObject object. If you place a data format in the DataObject object 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.

    Tip

    When using data formats that are not natively supported by Visual FoxPro or when using a large number of formats, you can improve OLE drag-and-drop performance by placing only the data formats on the DataObject object when a large amount of data is placed on the DataObject object.

    See Also

    Reference

    ClearData Method

    GetData Method

    GetFormat Method

    OLE Drag-and-Drop

    OLEDragDrop Event

    OLESetData Event

    OLEStartDrag Event

    SetData Method

    Other Resources

    Methods (Visual FoxPro)