Hide

SftDirectory 3.5 - ActiveX File/Folder Control

Display
Print

DataObject.GetFormat Method

Determines if a specified clipboard format is supported by the DataObject object.

Syntax

VB.NETFormatSupported = object.GetFormat(ByVal Format As Short) As Boolean
VBFormatSupported = object.GetFormat(ByVal Format As Integer) As Boolean
C#.NETbool FormatSupported = object.GetFormat(short Format);
VC++VARIANT_BOOL FormatSupported = object->GetFormat(short Format);
CHRESULT object->raw_GetFormat(short Format, VARIANT_BOOL* FormatSupported);

object

A DataObject object.

Format

The data format requested.

FormatValueDescription
sftCFText1Text
sftCFBitmap2Bitmap
sftCFMetafile3Metafile
sftCFDIB8Device independent bitmap
sftCFFiles15List of files
sftCFRTF-16639Rich text format

FormatSupported

Returns True if the specified clipboard format Format is supported by the DataObject object, otherwise False is returned.

Comments

The GetFormat method determines if a specified clipboard format is supported by the DataObject object.

The GetFormat method returns True if a data format in the DataObject object matches the specified format. Otherwise, it returns False.

Examples

VB.NET

    AxSftDirectory1.AutoExpandDragDrop = True
End Sub

Private Sub AxSftDirectory1_OLEDragDrop(ByVal sender As Object, ByVal e As AxSftDirectoryLib30._ISftDirectoryEvents_OLEDragDropEvent) Handles AxSftDirectory1.OLEDragDrop
    ' make sure the control doesn't perform its usual default handling of
    ' the files (copy/move, etc.)
    e.defaultHandling = False

    If e.data.GetFormat(SftOLEClipboardConstants.sftCFFiles) Then
        Dim I As Integer
        For I = 1 To e.data.Files.Count
            MessageBox.Show("""" & e.data.Files(I) & """ being dropped.")
            ' perform your own processing here
        Next
    Else
        ' some other format

VB6

    SftDirectory1.OLEDropMode = OLEDropSftControlManual
    SftDirectory1.AutoExpandDragDrop = True
End Sub

Private Sub SftDirectory1_OLEDragDrop(Data As SftDirectoryLib30.DataObject, _
        Folder As SftDirectoryLib30.ISftDirectoryFolder, Effect As Long, _
        Button As Integer, Shift As Integer, x As Single, y As Single, _
        DefaultHandling As Boolean)
    If Data.GetFormat(sftCFFiles) Then
        For i = 1 To Data.Files.Count
            MsgBox ("""" & Data.Files.Item(i) & """ being dropped.")
            ' perform your own processing here
        Next
    Else
        ' some other format
    End If

C#

}

private void axSftDirectory1_OLEDragDrop(object sender, AxSftDirectoryLib30._ISftDirectoryEvents_OLEDragDropEvent e)
{
    // make sure the control doesn't perform its usual default handling of
    // the files (copy/move, etc.)
    e.defaultHandling = false;

    if (e.data.GetFormat((short) SftOLEClipboardConstants.sftCFFiles)) {
        for (int i = 0 ; i < e.data.Files.Count ; ++i) {
            MessageBox.Show("\"" + e.data.Files[i+1] + "\" being dropped.");
            // perform your own processing here
        }
    } else {
        // some other format
    }

C++

    return TRUE;
}

void COLEDragDlg::OnOLEDragDropSftDirectory1(LPDISPATCH FAR* Data, LPDISPATCH FAR* Folder, long FAR* Effect, short FAR* Button, short FAR* Shift, float FAR* x, float FAR* y, BOOL FAR* DefaultHandling)
{
    IVDMDataObjectPtr pData(*Data);
    ISftDirectoryFolderPtr pFolder(*Folder);

    if (pData->GetFormat(sftCFFiles)) {
        int i;
        for (i = 1 ; i <= pData->Files->Count ; ++i) {
            CString str;
            CString strName((LPCWSTR)pData->Files->Item[i]);
            str.Format(_T("\"%s\" being dropped."), strName);
            MessageBox(str);
            // perform your own processing here

See Also DataObject Object | Object Hierarchy


Last Updated 08/13/2020 - (email)
© 2024 Softel vdm, Inc.