VAPIM_ENABLEINDEX

Enables index-only mode, also called document filtering. This generates text buffer (VAPINM_TEXTBUFFER) notification messages with document viewing disabled. The first text buffer notification message is generated after a VAPIMWP_INIT_OPEN_DOCUMENT message is sent. To get additional text buffer notification messages in this mode, call the VAPIM_GETNEXTTEXTBUFFER message.

Syntax

#include <kvvapi.h>
SendMessage(hWndVAPI, 
            VAPIM_ENABLEINDEX, 
           (WPARAM) n_IndexMode,
           (LPARAM) (TPVAPIHiLiteColor*) lpHiLiteColor );

Arguments

Argument

Description

hWndVAPI

The handle of the VAPI window.

n_IndexMode

0 – Combined mode (document view and text buffers)

1 – Text buffers only

2 – Disable index (document view only)

lpHiLiteColor

A pointer to a TPVAPIHiLiteColor structure that defines the highlight color used to signify an index hit.

Returns

SendMessage() returns TRUE if successful; FALSE otherwise.

Discussion

  • This message is passed to the VAPI control window to notify the Viewing display engine that a document index is under way. This message must be sent before the VAPIMWP_INIT_OPEN_DOCUMENT message. Check the return value from VAPIMWP_INIT_OPEN_DOCUMENT to make sure that indexing was really supported.

  • Calling this message produces a sequence of VAPINM_TEXTBUFFER notification messages to the calling window—that is, the parent of the VAPI window—as well as enabling the viewing engine to handle highlight and annotation requests. If you are using index-only mode, the VAPI window should be hidden and destroyed when the index is complete. No GDI output is generated and no information is stored to render the document. This results in a faster initial index of the document.

    When Viewing is in index-only mode, VAPIM_GETNEXTTEXTBUFFER messages must be used to drive Viewing to obtain VAPINM_TEXTBUFFER notification messages, with the exception of the very first buffer. In other words, after you send a VAPIMWP_INIT_OPEN_DOCUMENT message, you either get back one VAPINM_TEXTBUFFER notification message automatically, or two when there is only one buffer in the file. When you need more, request it.

  • When text buffers are no longer necessary, send VAPIM_ENABLEINDEX with n_IndexMode set to 2 and reopen the same document.