Open and View a Document

Because a document must be opened before it can be viewed, printed, saved, or can have any other operation performed on it, viewing a document in the Viewing API means to open and view a document. It is possible, however, to open a document without viewing it, or in other words, to open a document with view mode disabled. In this mode, you can print or save the document without viewing it.

To open a document

  1. Create a TPVAPIOpenDocumentInfo structure.

    To open a document without viewing it (view mode disabled), set the VAPIDF_FLAGS_OPEN_WITHOUT_VIEW flag in the nFlags member of the TPVAPIOpenDocumentInfo structure.

  2. Send VAPI a VAPIM_INIT message with the wParam set to VAPIMWP_INIT_OPEN_DOCUMENT, and the lParam set to the address of the TPVAPIOpenDocumentInfo structure. See VAPIMWP_INIT_OPEN_DOCUMENT.

    For example:

    memset (&OpenDocInfo, 0, sizeof(TPVAPIOpenDocumentInfo));
    OpenDocInfo.lpszFilePath = szFileName;
    lResult = SendMessage (hWndVAPI, VAPIM_INIT, VAPIMWP_INIT_OPEN_DOCUMENT, (LPARAM)OpenDocInfo);

Notification Messages