Jaa


IContentListFactory::GetData Method

For the latest version of Commerce Server 2007 Help, see the Microsoft Web site.

Use this method to read data from a specified row and column in a ContentListFactory object.

This is one of the two ContentListFactory methods that do not support a scriptable interface. The other method is SetData. They are only intended for use in C++.

Due to performance considerations, this method is not intended for use from Visual Basic or VBScript.

HRESULT IContentListFactory::GetData(
  long iRow,
  long iCol,
  BYTE* pData
);

Parameters

  • iRow
    [C++]

    [in] A long that contains the position of the row from which the data should be read. Row positions are counted from 0, not 1.

  • iCol
    [C++]

    [in] A long that contains the position of the column within the specified row from which the data should be read. Column positions are counted from 0, not 1.

  • pData
    [C++]

    [out] A pointer to where the data should be written.

Return Value

[C++]

This method returns an HRESULT indicating whether it completed successfully. See the Error Values section for more details.

Error Values

[C++]

This method returns S_OK (0x00000000) to indicate success and standard COM HRESULT error values to indicate failure. For more information about standard COM errors, see Standard COM Errors. Additional information may be available using the global Err object, which can be accessed using the API function GetErrorInfo. In particular, the GetDescription method of the IErrorInfo interface may return a text description of the error.

Remarks

The GetData method does not do any type checking. The memory pointed to by the pData parameter must be of sufficient size to receive the value being read. If the allotted memory is too small, memory corruption occurs.

The ContentListFactory object stores some types of data by value and other types of data by reference. Therefore, how you use the GetData and SetData methods depends on the data type.

When you pass a pointer to a String to the SetData method, it stores the String in the ContentListFactory object, not the pointer. The GetData method returns a pointer to the String in the ContentListFactory object, but not the String. Do not hold a reference to the String in the ContentListFactory object beyond the lifetime of the object, as it will be invalid after the object is destroyed. The ContentListFactory object only stores wide character Unicode strings. ANSI strings are not supported.

When you pass an interface pointer to an object to the SetData method, it calls the AddRef method on the interface referenced by the pointer and stores the pointer in the ContentListFactory object. The GetData method returns this pointer and calls the AddRef method on the interface referenced by it. The caller must release the pointer returned by the GetData method.

When you pass a pointer to a SafeArray to the SetData method, it locks the SafeArray and stores a reference to it in the ContentListFactory object. The GetData method returns a reference to the locked array. The caller should not unlock the array as this could invalidate the reference stored in the ContentListFactory object. It is safe to store the array in a Variant of type VT_ARRAY or VT_VARIANT, as a call to the VariantClear method will not release the SafeArray because it is locked. When the ContentListFactory object is destroyed, the SafeArray will be unlocked and the SafeArrayDestroy method will be called. Since SafeArrays have a lock count similar to reference counting the array data will be released only if the lock count is zero.

The GetData method reads all other supported data types by value.

This method is functionally identical to the one of the same name in the ContentList object.

See Also

Other Resources

ContentListFactory Object