Hide

SftMask/OCX 7.0 - ActiveX Masked Edit Control

Display
Print

GetData Method, DataObject Object

Retrieves data of a specified format from a DataObject object.

Syntax

VB.NETData = object.GetData([ ByVal Format As Object ] ) As Object
VBData = object.GetData([ ByVal Format As Variant ] ) As Variant
C#.NETobject Data = object.GetData(object Format);
VC++_variant_t Data = object->GetData(const _variant_t& Format = vtMissing);
CHRESULT object->raw_GetData(VARIANT Format, VARIANT* Data);

object

A DataObject object.

Format

The data format requested. The Format argument is optional. If Format is not specified, GetData returns data in a suitable format.

FormatValueDescription
sftCFText1Text (as a String value)
sftCFBitmap2Bitmap (as Picture object)
sftCFMetafile3Metafile (as Picture object)
sftCFDIB8Device independent bitmap (as Picture object)
sftCFFiles15List of files. GetData cannot be used to retrieve this format. Use the Files collection instead.
sftCFRTF-16639Rich text format (as String value)

Data

Retrieves data of a specified format from a DataObject object.

Comments

The GetData method retrieves data of a specified format from a DataObject object.

It is possible for the GetData and SetData methods to use data formats other than those listed as valid Format argument, including user-defined formats registered with Windows via the RegisterClipboardFormat() API function. The SetData method requires the data to be in the form of a byte array when it does not recognize the data format specified. The GetData method always returns data in a byte array when it is in a format that it doesn't recognize, although this may be transparently converted into other data types, such as strings. The byte array returned by GetData will be larger than the actual data when running on some operating systems, with arbitrary bytes at the end of the array. This allocation of memory is often larger than is actually required for the data. Therefore, there may be extraneous bytes near the end of the allocated memory segment.

Examples

VB.NET

    AxSftMask1.MaxLength = 300
    AxSftMask1.PromptUnderline = False
    AxSftMask1.OLEDropMode = SftMaskOLEDropModeConstants.OLEDropSftMaskManual
End Sub

Private Sub AxAxSftMask1_OLEDragDrop(ByVal sender As Object, ByVal e As AxSftMaskLib70._ISftMaskEvents_OLEDragDropEvent) Handles AxSftMask1.OLEDragDrop
    Dim S As String
    If e.data.GetFormat(SftOLEClipboardConstants.sftCFText) Then
        S = e.data.GetData(SftOLEClipboardConstants.sftCFText)
        AxSftMask1.SelStart = e.targetChar
        AxSftMask1.SelText = S
    Else
        e.effect = 0 ' vbDropEffectNone
    End If
End Sub

VB6

    SftMask1.MaxLength = 300
    SftMask1.PromptUnderline = False
    SftMask1.OLEDropMode = OLEDropSftMaskManual
End Sub

Private Sub SftMask1_OLEDragDrop(Data As SftMaskLib70.DataObject, TargetChar As Long, Effect As Long, Button As Integer, Shift As Integer, x As Single, y As Single)
    Dim S As String
    If Data.GetFormat(sftCFText) Then
        S = Data.GetData(sftCFText)
        SftMask1.SelStart = TargetChar
        SftMask1.SelText = S
    Else
        Effect = vbDropEffectNone
    End If
End Sub

C#

    axSftMask1.PromptUnderline = false;
    axSftMask1.OLEDropMode = SftMaskOLEDropModeConstants.OLEDropSftMaskManual;
}

private void axSftMask1_OLEDragDrop(object sender, AxSftMaskLib70._ISftMaskEvents_OLEDragDropEvent e)
{
    string s;
    if (e.data.GetFormat((short) SftOLEClipboardConstants.sftCFText)) {
        s = (string) e.data.GetData(SftOLEClipboardConstants.sftCFText);
        axSftMask1.SelStart = e.targetChar;
        axSftMask1.SelText = s;
    } else {
        e.effect = 0; //vbDropEffectNone
    }
}

C++

    return TRUE;
}

void CProject1Dlg::OnOLEDragDropSftMask1(LPDISPATCH FAR* Data, long FAR* TargetChar, long FAR* Effect, short FAR* Button, short FAR* Shift, float FAR* x, float FAR* y)
{
    IVDMDataObjectPtr pData = *Data;

    if (pData->GetFormat(sftCFText) != VARIANT_FALSE) {
        _variant_t data = pData->GetData(_variant_t((long) sftCFText));
        data.ChangeType(VT_BSTR);
        m_pMask1->SelStart = *TargetChar;
        m_pMask1->SelText = data.bstrVal;
    } else
        *Effect = DROPEFFECT_NONE;
}

See Also DataObject Object | Object Hierarchy


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