method ExDataObject.GetFormat (Format as Integer)

Returns a value indicating whether the ExDataObject's data is of specified format.

TypeDescription
Format as Integer A constant or value that specifies a clipboard data format like described in exClipboardFormatEnum enum.
ReturnDescription
BooleanA boolean value that indicates whether the ExDataObject's data is of specified format.

Use the GetFormat property to verify if the ExDataObject's data is of a specified clipboard format. The GetFormat property retrieves True, if the ExDataObject's data format matches the given data format. Use the Files property to retrieves the filenames if the format of data is exCFiles. The OLEDragDrop event notifies your application that the user drags some data on the control. The control fires the OLEStartDrag event to notify your application that the user stars dragging files.

The following VB sample retrieves the text being dragged to the control:

Private Sub ExFileView1_OLEDragDrop(ByVal Data As EXFILEVIEWLibCtl.IExDataObject, Effect As Long, ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
    With Data
        If .GetFormat(EXFILEVIEWLibCtl.exClipboardFormatEnum.exCFText) Then
            MsgBox .GetData(EXFILEVIEWLibCtl.exClipboardFormatEnum.exCFText)
        End If
    End With
End Sub

The following C++ sample retrieves the text being dragged to the control:

#import <exfilevw.dll>
void OnOLEDragDropExfileview1(LPDISPATCH Data, long FAR* Effect, short Button, short Shift, long X, long Y) 
{
	EXFILEVIEWLib::IExDataObjectPtr spData( Data );
	if ( spData )
		if ( spData->GetFormat( 1 /*exCFText*/ ) )
		{
			CString strText = V2S( &spData->GetData( 1 /*exCFText*/ ) );
			MessageBox( strText );
		}
}

The C++ requires #import <exfilevw.dll> to import definitions for ExDataObject and ExDataObjectFiles objects. The #import <exfilevw.dll> generates the EXFILEVIEWLib namespace. If the exfilevw.dll file is located in other directory than system folder, the correct path should be provided, else a compiler error occurs.

The V2S function converts a VARIANT expression to a string, and may look like follows:

static CString V2S( VARIANT* pv, LPCTSTR szDefault = _T("") )
{
	if ( pv )
	{
		if ( pv->vt == VT_ERROR )
			return szDefault;

		COleVariant vt;
		vt.ChangeType( VT_BSTR, pv );
		return V_BSTR( &vt );
	}
	return szDefault;
}

The following VB.NET sample retrieves the text being dragged to the control:

Private Sub AxExFileView1_OLEDragDrop(ByVal sender As Object, ByVal e As AxEXFILEVIEWLib._IExFileViewEvents_OLEDragDropEvent) Handles AxExFileView1.OLEDragDrop
    With e.data
        If .GetFormat(EXFILEVIEWLib.exClipboardFormatEnum.exCFText) Then
            MessageBox.Show(.GetData(EXFILEVIEWLib.exClipboardFormatEnum.exCFText))
        End If
    End With
End Sub

The following C# sample retrieves the text being dragged to the control:

private void axExFileView1_OLEDragDrop(object sender, AxEXFILEVIEWLib._IExFileViewEvents_OLEDragDropEvent e)
{
	if (e.data.GetFormat(Convert.ToInt16(EXFILEVIEWLib.exClipboardFormatEnum.exCFText)))
		MessageBox.Show(e.data.GetData(Convert.ToInt16(EXFILEVIEWLib.exClipboardFormatEnum.exCFText)).ToString());
}

The following VFP sample retrieves the text being dragged to the control:

*** ActiveX Control Event ***
LPARAMETERS data, effect, button, shift, x, y

With data
	If .GetFormat( 1 ) Then && exCFText
		wait window nowait .GetData( 1 ) && exCFText
	EndIf
EndWith