Opens a document for one of the following operations:
This is a parameter of the VAPIM_INIT
message. See Open and View a Document.
#include <kvvapi.h> SendMessage(hWndVAPI, VAPIM_INIT, VAPIMWP_INIT_OPEN_DOCUMENT, (LPARAM) (TPVAPIOpenDocumentInfo*) pOpenDocumentInfo );
Argument |
Description |
---|---|
|
The handle of the VAPI window. |
|
A pointer to a TPVAPIOpenDocumentInfo structure that contains information about the document to be opened. |
SendMessage()
returns VAPI_RETURN_SUCCESS
if the document opening is successfully initiated. SendMessage()
returns VAPI_RETURN_NO_VIEWER
.SendMessage()
returns VAPI_RETURN_UNKNOWN_FORMAT
.SendMessage()
returns VAPI_RETURN_PASSWORD_PROTECTED
.SendMessage()
returns VAPI_RETURN_NOT_INITIALIZED
.SendMessage()
returns VAPI_RETURN_NO_PAGE
.SendMessage()
returns VAPI_RETURN_NOT_AVAILABLE
.SendMessage()
returns VAPI_RETURN_INVALID_LICENSE_KEY
.SendMessage()
returns VAPI_RETURN_EXPIRED_LICENSE_KEY
.SendMessage()
returns VAPI_RETURN_BAD_INPUT
.VAPI_RETURN_ERROR
to be returned.This message initiates the document opening and returns before the document opening is complete unless you set the bWait
parameter in the TPVAPIOpenDocumentInfo
structure to TRUE
.
This message produces several notification messages:
One or more VAPINMWP_INIT_OPENDOCDONE
notification messages are received to report the status of the document opening.
In addition, if the document to be opened contains pages, a VAPINMWP_INIT_PAGENUMBER
notification message is received to report the current page number.
Finally, if the document to be opened contains objects (for example, a spreadsheet document containing pages), a VAPINMWP_MULTIOBJ_OBJNAME
notification message is received to report the current object name (for example, the name of the current spreadsheet page).
To open a document to view as text, set the bViewAsText
parameter in the TPVAPIOpenDocumentInfo
structure to TRUE
.
To open and process a document (print, convert, and so on) without viewing, set the nFlags
parameter in the TPVAPIOpenDocumentInfo
structure to VAPIDF_FLAGS_OPEN_WITHOUT_VIEW
. This flag tells VAPI to create a hidden Viewer window. You must also set the bWait
parameter in the TPVAPIOpenDocumentInfo
structure to TRUE
, except when you use APIs to draw documents without viewing. See Draw a Page for more information.
For example, to print a document without viewing, open the document with the bWait
parameter set to TRUE
and the nFlags
parameter set to VAPIDF_FLAGS_OPEN_WITHOUT_VIEW
, and then send the VAPIMWP_PRINT_PRINT
message.
To open a document and return format information without viewing, set the nFlags
parameter in the TPVAPIOpenDocumentInfo
structure to VAPIDF_FLAGS_OPEN_VAPI_ONLY
. This flag does not create a Viewer window.
To make sure that a document is fully processed before an operation (such as printing, converting, or searching) is performed, set the bWait
parameter in the TPVAPIOpenDocumentInfo
structure to TRUE
. This is useful when you want to use an operation immediately after opening the document.
|