?
Solved

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

Posted on 2002-05-01
3
Medium Priority
?
292 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
[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
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 300 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
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…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

743 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