Solved

OLE Automation Problem

Posted on 2004-04-06
2
246 Views
Last Modified: 2010-04-05
I am trying to do some OLE automation.

There are two possible scenarios that occur when my client tries to "talk" to my server.


A.   Server is already running.  Client does its thing properly, and when finished, the server keeps running.  (This is the desired behavior)

B.   Server is not already running.  When client requests the interface, the server EXE is automatically launches and the client does its thing properly.  This is good.  However, as soon as the client is done with the interface, the server EXE closes.  (This is not the desired behavior)


In scenario B, how do I make it so the server continues to run after the client is done with it?  (i.e., never automatically closes)
0
Comment
Question by:scrapdog
[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 Comments
 
LVL 26

Accepted Solution

by:
Russell Libby earned 500 total points
ID: 10769172
Catch and handle the ComServer.OnLastRelease

simplified (but functional) example

type
  TComHandler = class(TObject)
  public
     procedure OnLastRelease(var Shutdown: Boolean);
  end;

procedure TComHandler.OnLastRelease(var Shutdown: Boolean);
begin
  Shutdown:=False;
end;

initialization

  TAutoObjectFactory.Create(ComServer, TMemoApp, Class_MemoApp, ciSingleInstance, tmApartment);

  if (ComServer.StartMode = smAutomation) then
  begin
     with TComHandler.Create do ComServer.OnLastRelease:=OnLastRelease;
  end;


Regards,
Russell

0
 
LVL 5

Author Comment

by:scrapdog
ID: 10769245
Excellent.  Thanks.
0

Featured Post

[Webinar] How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

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

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…
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Come and listen to Percona CEO Peter Zaitsev discuss what’s new in Percona open source software, including Percona Server for MySQL (https://www.percona.com/software/mysql-database/percona-server) and MongoDB (https://www.percona.com/software/mongo-…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…

688 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