Solved

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

Posted on 2002-05-01
3
289 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
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…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

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