 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Parmod Guest
|
Posted: Sun Nov 09, 2003 5:21 am Post subject: How can a COM server determine that client is no longer ther |
|
|
I am trying to write a COM server and various COM clients. The code works
until the client crashes for some reason, at which point the server just
goes crazy trying to send events to the client who has passed away. Can
someone tell me how to determine that the client is no longer there. I use
the following code to send events.
Thanks in advance for your help.
Parmod
function GetConnectionEnumerator: IEnumConnections;
var
Container: IConnectionPointContainer;
CP: IConnectionPoint;
begin
Result := nil;
try
//+++++got error here
OleCheck(QueryInterface(IConnectionPointContainer, Container));
OleCheck(Container.FindConnectionPoint(AutoFactory.EventIID, CP));
OleCheck(CP.EnumConnections(Result));
except
on E: Exception do
ShowMessage('GetConnectionEnumerator: '+E.Message);
end;
end;
procedure OnAboutRequest;
var
EC: IEnumConnections;
ConnectData: TConnectData;
Fetched: Cardinal;
begin
EC := GetConnectionEnumerator;
if EC <> nil then
begin
while EC.Next(1, ConnectData, @Fetched) = S_OK do
if (Fetched = 1) and (ConnectData.pUnk <> nil) then
(ConnectData.pUnk as ISpeechXTrayEvents).OnAbout;
end;
end;
|
|
| Back to top |
|
 |
Maynard Philbrook Guest
|
Posted: Sun Nov 09, 2003 8:16 pm Post subject: Re: How can a COM server determine that client is no longer |
|
|
just post some kind of ping message to the client that has to echo back.
Parmod wrote:
| Quote: | I am trying to write a COM server and various COM clients. The code works
until the client crashes for some reason, at which point the server just
goes crazy trying to send events to the client who has passed away. Can
someone tell me how to determine that the client is no longer there. I use
the following code to send events.
Thanks in advance for your help.
Parmod
function GetConnectionEnumerator: IEnumConnections;
var
Container: IConnectionPointContainer;
CP: IConnectionPoint;
begin
Result := nil;
try
//+++++got error here
OleCheck(QueryInterface(IConnectionPointContainer, Container));
OleCheck(Container.FindConnectionPoint(AutoFactory.EventIID, CP));
OleCheck(CP.EnumConnections(Result));
except
on E: Exception do
ShowMessage('GetConnectionEnumerator: '+E.Message);
end;
end;
procedure OnAboutRequest;
var
EC: IEnumConnections;
ConnectData: TConnectData;
Fetched: Cardinal;
begin
EC := GetConnectionEnumerator;
if EC <> nil then
begin
while EC.Next(1, ConnectData, @Fetched) = S_OK do
if (Fetched = 1) and (ConnectData.pUnk <> nil) then
(ConnectData.pUnk as ISpeechXTrayEvents).OnAbout;
end;
end;
|
--
To See what real programmers do in their spare time visit
http://jamie12.home.mindspring.com
home of PC bit software ..
Please send comments about my work .
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|