Solved

MSWord FileOpen

Posted on 1997-02-28
4
260 Views
Last Modified: 2013-12-03
I have successfully used OLE Automation to open a file into MSWord from an MFC application. However, my problem is that if the MSWord get's started by the MFC application's COleDispatchDriver::CreateDispatch call then it also shuts down when my MFC application shuts down. How can I change this behaviour so that the MSWord would stay running even if the MFC application shuts down ?
0
Comment
Question by:kso
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 1

Expert Comment

by:mbecker011597
ID: 1299007
I guess that COleDispatchDriver's destructor automatically closes the called application. Try to override the destructor that it does not close the application.

M.

0
 

Author Comment

by:kso
ID: 1299008
It's not possible to override a destructor.
Could I implement this without COleDispatchDriver by calling
AddRef() but not calling Release() ?
0
 

Author Comment

by:kso
ID: 1299009
Adjusted points to 170
0
 
LVL 1

Accepted Solution

by:
bhoward earned 170 total points
ID: 1299010
Launch Word before using the OLE Automation commands.  Use FindExecutable() and then WinExec().

HINSTANCE hinst;
char TheExe[ _MAX_PATH + 1];
hinst = (HINSTANCE)FindExecutable( "winword.exe", NULL, TheExe );
if (hinst > HINSTANCE_ERROR)
   WinExec( TheExe, SW_SHOW );
 

0

Featured Post

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article shows how to make a Windows 7 gadget that accepts files dropped from the Windows Explorer.  It also illustrates how to give your gadget a non-rectangular shape and how to add some nifty visual effects to text displayed in a your gadget.…
With most software applications trying to cater to multiple user needs nowadays, the focus is to make them as configurable as possible. For e.g., when creating Silverlight applications which will connect to WCF services, the service end point usuall…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

749 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question