File Content Extraction 26.1
Viewing SDK Programming Guide

# Create a Viewing API Window

You must create a new VAPI window for each document that you open; each VAPI window manages only one document at a time.

You can create multiple VAPI windows to handle multiple documents simultaneously. After you create a VAPI window, you can use the Viewing API to manage the document by sending messages to the window and receiving notification messages from the window. When you are finished with the document, you destroy its VAPI window.

To create the VAPI window, use the standard Windows API functions `CreateWindow()` or `CreateWindowEx()`, with the following parameter values:

Parameter | Value/Description
--- | ---
`LPCTSTR lpClassName` | `VAPIDF_VAPI_WINDOW_CLASS_NAME` (defined in `kvvapi.h`).
`LPCTSTR lpWindowName` | `NULL`.
`DWORD dwStyle` | `WS_CHILD` or `WS_DISABLED`
`int x, y` | `0, 0`
`int nWidth` | The width of the application (parent) window.
`int nHeight` | The height of the application (parent) window.
`HWND hWndParent` | The handle of the application window. (See note below.)
`HMENU hMenu` | `NULL`.
`HINSTANCE hInstance` | The handle of the VAPI library.
`LPVOID lpParam` | A pointer to a TPVAPICreateParams structure that specifies optional parameters. Through this structure, you specify whether you are using an initialization file or registry settings.

For example:

    hWndVAPI = CreateWindow (VAPIDF_VAPI_WINDOW_CLASS_NAME,
                        NULL,
                        WS_CHILD | WS_DISABLED,
                        rc.left, rc.top, rc.right, rc.bottom,
                        hWnd,
                        NULL,
                        hLibVAPI,
                        &CreateParams);

To use the window, you must provide your license information. To do so, use the Windows API function `SendMessage()`.

Parameter | Value/Description
--- | ---
`HWND hWnd` | The handle of the VAPI window.
`UINT Msg` | `VAPIM_INIT`
`WPARAM wParam` | `VAPIMWP_INIT_SETLICENSE`
`LPARAM lParam` | A pointer to your license string.

For example:

    response = SendMessage(hWndVAPI, VAPIM_INIT, VAPIMWP_INIT_SETLICENSE, (LPARAM)"YOUR_LICENSE_KEY");

## Get the Viewer Window of the Document

The Viewer window is a document-specific window that the VAPI window creates when you open a document. Because the Viewer window is controlled by the VAPI window, normally you should not need the handle of the Viewer window.

The Viewer window is subclassed by the VAPI window. That is, when the VAPI window creates the Viewer window, it subclasses the Viewer window so that the VAPI window intercepts all messages sent to the Viewer window. This allows the VAPI window to control the Viewer window and to handle the right-mouse context menu and common operations such as SaveAs.

Depending on the document type, the Viewer window might also create several child windows in order to handle the document. For example, when you open a spreadsheet document, the VAPI window creates a `[WorkBook]` Viewer window, which in turn creates a `[SpreadSheet]` Viewer window for each spreadsheet page when it is accessed. All VAPI child windows are destroyed when the VAPI window is destroyed.

- To get the Viewer window handle of a document, use the VAPIMWP_INIT_GETHWNDVIEWER message.

- To disable the Viewer user interface for a document (that is, when the Viewer asks if the user interface is disabled before creating a dialog box), respond to the VAPINMWP_INIT_DISABLEUI notification message.

Copyright 2016-2025 Open Text
Version 26.1 | Last updated January 2026

Send documentation feedback

Close

Send documentation feedback

To send feedback using your default email client, open an email window.

Otherwise, send your feedback and the information below to MFI-swpdl.idoldocsfeedback@opentext.com.

We appreciate your feedback!

Product: File Content Extraction 26.1

Topic Title: Create a Viewing API Window