Solved

How to close one instance of an OLE application without closing its RPC server along with it

Posted on 2002-05-01
3
284 Views
Last Modified: 2010-04-04
Hi Community,

I have developed an application in Delphi 5, which reads information from a MS WORD document and parses it into HTML. I have used OLE technology to achieve this. The problem is that if I start another instance of MS Word form the start menu while I am running my application and close the MS Word (application that i started from the start menu) the RPC server instance also gets destroyed and everytime I want to refresh the details in my Delphi application an error message appears saying "RPC Server not found" .

How to overcome this problem ? I havetried using threads etc. Please suggest me something .

Thanks and regards

Ashish Agnihotri
0
Comment
Question by:ashishagnihotri
3 Comments
 

Expert Comment

by:lottol
ID: 6985134
You can check active OLE object. Here is an example of it for Excel.

try
  Excel:=GetActiveOLEObject('Excel.Application');
except
  try
   Excel:=CreateOLEObject('Excel.Application');
  except
   MessageDlg('Cannot create Ole object'#39
               +'Excel.Application!',mtError,[mbOK],0);
   exit;
  end;
end;
0
 
LVL 2

Accepted Solution

by:
CSJ earned 100 total points
ID: 7251280
Hi,
This is a fault in some versions of word, please refer to following link:
http://support.microsoft.com/default.aspx?scid=kb;en-us;Q188546

To get round this you have to create a temporary ole instance:

var
  Word972000Bug, WP : Variant;
begin
  Word972000Bug := CreateOleObject('Word.Basic');
  WP := CreateOleObject('Word.Basic');
  Word972000Bug.AppClose;
  Word972000Bug := Unassigned;
  WP.AppShow;
  ..
end;

Hope this helps

Craig
0
 

Expert Comment

by:SpideyMod
ID: 8280690
Force Accepted

SpideyMod
Community Support Moderator @Experts Exchange
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
This video discusses moving either the default database or any database to a new volume.
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

747 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now