Link to home
Start Free TrialLog in
Avatar of ashishagnihotri
ashishagnihotri

asked on

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

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
Avatar of lottol
lottol

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;
ASKER CERTIFIED SOLUTION
Avatar of CSJ
CSJ

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Force Accepted

SpideyMod
Community Support Moderator @Experts Exchange