{oapdf_gg}
open and display word documents
Category in the main framework ID_FILE_OPEN add menu command response function in order to open Word documents to dynamically provide their support. The following code in the Word document file to be the full path will WM_COMMAND message by sending the document to create a new view:
View class in the initialization function update OnInitialUpdate () in the completion of the dynamics of embedded Word:
Which, EmbedAutomateWord () function will be responsible for the procedures will be embedded in Word. Its concrete realization of the process is as follows:
If you have looked carefully at the code, you will find it with AppWizard automatically generated OnInsertObject () function has a surprising degree of similarity, in fact, the above code is only OnInsertObject () of a special case: OnInsertObject () allows the user from the available OLE Object list, select the one inserted into the application. Because of this we need to do is to automate Word, so the act of derivation. Here through the use of CreateFromFile () method to open m_sPath designated by the Word document, and DoVerb () method implementation of the verb to complete the document OLEIVERB_SHOW show action. In order to embed the work area occupying the entire client area, the need to embed documents, customer size changes and update the view after the call Draw () method to re-draw. |