Platform SDK: Management Console

FormatData Method

Formats raw data in a Byte array into Visual Basic data types.

Syntax

FormatData(Data, StartingIndex As Long, Format As SnapInFormatConstants, [BytesUsed])

The FormatData method syntax has these parts:

Part Description
Data A Variant containing a Byte array that holds the raw data received from a call to MMCDataObject.GetData.
StartingIndex The one-based index of the element in the Byte array from which to begin interpreting the data.
Format Determines the data type to which the raw data should be converted.
BytesUsed Optional. Returns the number of bytes read and converted into the requested data type.

Settings

The Format argument settings are:

Constant Description
siBoolean Read 4 bytes and return them as a Boolean.
siCBoolean Read 2 bytes, convert them from a C/C++ language BOOL and return them as a Boolean.
siCurrency Read 8 bytes and return them as a Currency.
siDate Read 8 bytes and return them as a Date.
siDouble Read 8 bytes and return them as a Double.
siGUID Read 16 bytes as a binary GUID and return them as string in string format {00000000-0000-0000-0000-000000000000}.
siInteger Read 2 bytes and return them as an Integer.
siLong Read 4 bytes and return them as a Long.
siMultiString Read bytes as concatenated null-terminated Unicode strings terminated by a double Unicode null character. Return as an array of String.
siObject Read CLSID from start of bytes and remainder of bytes as the contents of a stream. Create an instance of the object and load it from the stream. Visual Basic classes that are marked Persistable can be exported by the primary snap-in for this type.
siObjectInstance Read the data as a reference to an instance of an object and return it as an Object.
siSingle Read 4 bytes and return them as a Single.
siString Read bytes as a null-terminated Unicode string. Return as a String. Visual Basic String variables exported by the primary snap-in are read using this type.

Return Values

The FormatData method returns a Variant containing the data type requested in the Format argument.

Remarks

This method is used in ExtensionSnapIn events to interpret the imported data. For more information see "MMCDataObject," "Importing Data from C++ Snap-ins," and "Publishing and Interpreting Data Formats from a Visual Basic Snap-in."