The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

IFilter::GetText method

Retrieves text (text-type properties) from the current chunk, which must have a CHUNKSTATE enumeration value of CHUNK_TEXT.


SCODE GetText(
  [in, out] ULONG *pcwcBuffer,
  [out]     WCHAR *awcBuffer


pcwcBuffer [in, out]

Type: ULONG*

On entry, the size of the awcBuffer array in Unicode characters. On exit, the number of Unicode characters written to awcBuffer. Note that this value is not the number of bytes in the buffer.

awcBuffer [out]

Type: WCHAR*

Text retrieved from the current chunk as a null-terminated string. The null-terminated string should not exceed the size of the destination buffer.

Return value


Return codeDescription

Successful completion.


The flags member of the STAT_CHUNK structure for the current chunk does not have a value of CHUNK_TEXT.


All the text in the current chunk has been returned. Additional calls to the GetText method should return this error until the IFilter::GetChunk method has been called successfully.


As an optimization, the last call that returns text can return FILTER_S_LAST_TEXT, which indicates that the next call to the GetText method will return FILTER_E_NO_MORE_TEXT. This optimization can save time by eliminating unnecessary calls to GetText.



IFilter components for Windows Search run in the Local Security context and should be written to manage buffers and to stack correctly. All string copies must have explicit checks to guard against buffer overruns. You should always verify the allocated size of the buffer and test the size of the data against the size of the buffer. If the current chunk is too large for the awcBuffer array, more than one call to the GetText method can be required to retrieve all the text in the current chunk. Each call to the GetText method retrieves text that immediately follows the text from the last call to the GetText method. The last character from one call can be in the middle of a word, and the first character in the next call would continue that word, which is a sitution that search engines must handle.

The IFilterSample code sample, available on Code Gallery and the Windows 7 SDK, demonstrates how to create an IFilter base class for implementing the IFilter interface.

For conceptual information about IFilter implementation, see Developing Filter Handlers. For information about IFilters and property handlers, see "Full-Text Support" and "Operating System Implementation Considerations" in Developing Property Handlers for Windows Search.

Important  In Windows 7 and later, filters written in managed code are explicitly blocked. Filters MUST be written in native code due to potential CLR versioning issues with the process that multiple add-ins run in.


Minimum supported client

Windows 2000 Professional [desktop apps only]

Minimum supported server

Windows 2000 Server [desktop apps only]


the Windows NT 4.0 Option Pack



See also