IContentListFactory::GetData

Ee809939.c++_off(en-US,CS.10).gifEe809939.vb_on(en-US,CS.10).gif

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++.

Definition

HRESULT IContentListFactory::GetData(longiRow,longiCol,BYTE*pData);

Parameters

iRow

[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

[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

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

Return Values

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

Error Values

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

ContentListFactory Object


All rights reserved.