![]() |
![]() | #1 |
Младенец Join Date: 08 2006 Location: Currently in Germany.
Posts: 2
Downloads: 0 Uploads: 0
Reputation: 0 | 0 | ![]() Hi, I have the following question. I’m writing the program in C++, which is opening in background the Word document, modifying and then closing it. Till now each document has been opened with separate Word application and after modification has been closed: CApplication objWord; if(!objWord.CreateDispatch("Word.Application")) ..... CDocuments docs(objWord.get_Documents()); doc.AttachDispatch(docs.Open(....)); ..... docs.Close(covFalse,covOptional,covOptional); objWord.Quit(covFalse,covTrue,covFalse); Now I want to open Word application only once, and then in consecutive order open, manipulate and close the documents. Of course I can check whether “winword.exe” process existing or not and also read the PID, but how can I steer the document? |
![]() |
![]() | #2 |
Младенец Join Date: 08 2006 Location: Currently in Germany.
Posts: 2
Downloads: 0 Uploads: 0
Reputation: 0 | 0 | ![]() Dear Colleagues, I found that my question was not presented very clear. I'll try to explain it better. Firs of all I should mention that I’m faraway from COM and OLE programming, but now I'm working on one project and I guess I need to learn that. The problem is following. I have a Windows service, which is working according to some algorithm. From time to time it creates the process, runs the MS Word application, opens the Word document, manipulates it and then closes the document and Word application. Now I should increase the speed of this process. I have found that starting the Word application consumed most of the time. Therefore I have decided to open the Word application only once and then, when it is necessary, open and manipulate the Word documents. The only information I have is PID (PROCESS_INFORMATION) of the process, created by CreateProcess. My question is following. How can I get access to the already opened Word application, open there the Word document and manipulate it. Thank you in advance, Suren Karabekyan |
![]() |