VAPIMWP_INIT_OPEN_DOCUMENT
Opens a document for one of the following operations:
This is a parameter of the VAPIM_INIT
message. See Open and View a Document.
Syntax
#include <kvvapi.h> SendMessage(hWndVAPI, VAPIM_INIT, VAPIMWP_INIT_OPEN_DOCUMENT, (LPARAM) (TPVAPIOpenDocumentInfo*) pOpenDocumentInfo );
Arguments
Argument |
Description |
---|---|
|
The handle of the VAPI window. |
|
A pointer to a TPVAPIOpenDocumentInfo structure that contains information about the document to be opened. |
Returns
SendMessage()
returnsVAPI_RETURN_SUCCESS
if the document opening is successfully initiated.- If there is no viewer for the specified document,
SendMessage()
returnsVAPI_RETURN_NO_VIEWER
. - If the format of the document could not be determined,
SendMessage()
returnsVAPI_RETURN_UNKNOWN_FORMAT
. - If the document is password protected,
SendMessage()
returnsVAPI_RETURN_PASSWORD_PROTECTED
. - If the drawing routines have not been initialized,
SendMessage()
returnsVAPI_RETURN_NOT_INITIALIZED
. - If the requested page does not exist, or is being displayed before all previous pages have been displayed,
SendMessage()
returnsVAPI_RETURN_NO_PAGE
. - If the document does not support this feature (for example, ZIP files, video, audio),
SendMessage()
returnsVAPI_RETURN_NOT_AVAILABLE
. - If the KeyView license is invalid,
SendMessage()
returnsVAPI_RETURN_INVALID_LICENSE_KEY
. - If the KeyView license is expired,
SendMessage()
returnsVAPI_RETURN_EXPIRED_LICENSE_KEY
. - If the input file or stream is invalid or corrupt,
SendMessage()
returnsVAPI_RETURN_BAD_INPUT
. - Any other error condition causes
VAPI_RETURN_ERROR
to be returned.
Discussion
-
This message initiates the document opening and returns before the document opening is complete unless you set the
bWait
parameter in theTPVAPIOpenDocumentInfo
structure toTRUE
. -
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 theTPVAPIOpenDocumentInfo
structure toTRUE
. -
To open and process a document (print, convert, and so on) without viewing, set the
nFlags
parameter in theTPVAPIOpenDocumentInfo
structure toVAPIDF_FLAGS_OPEN_WITHOUT_VIEW
. This flag tells VAPI to create a hidden Viewer window. You must also set thebWait
parameter in theTPVAPIOpenDocumentInfo
structure toTRUE
, 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 toTRUE
and thenFlags
parameter set toVAPIDF_FLAGS_OPEN_WITHOUT_VIEW
, and then send theVAPIMWP_PRINT_PRINT
message. -
To open a document and return format information without viewing, set the
nFlags
parameter in theTPVAPIOpenDocumentInfo
structure toVAPIDF_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 theTPVAPIOpenDocumentInfo
structure toTRUE
. This is useful when you want to use an operation immediately after opening the document.