?
Solved

OLE Automation Problem

Posted on 2004-04-06
2
Medium Priority
?
249 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 2000 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
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…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
Suggested Courses

752 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