anuragvelekkattu
asked on
COM Doubt(urgent)
Hi,
We have a situation like this
We have an OLE automation server which is an MDI application.(DNR). and a client application which automates the server.
[ This is very simple like we are writing an Automation client for excel.]
From the client application we create server object and created/get internal objects of server.
Same time user can close the server application window by clicking the CLOSE button or FILE/EXIT.
How the client knows the server is exited. Is there any standard method in COM to handle this situation?
(We prefer catching an error in client side. rather than modifying server code. )
regards
anuragvelekkattu
We have a situation like this
We have an OLE automation server which is an MDI application.(DNR). and a client application which automates the server.
[ This is very simple like we are writing an Automation client for excel.]
From the client application we create server object and created/get internal objects of server.
Same time user can close the server application window by clicking the CLOSE button or FILE/EXIT.
How the client knows the server is exited. Is there any standard method in COM to handle this situation?
(We prefer catching an error in client side. rather than modifying server code. )
regards
anuragvelekkattu
You need to use FindWindow , EnumWindowProc and other API funct. in order to determine whether the process is running
Usually the only way to know you are dropped is to Poll. That is to send a hearbeat to the server every few ms or so.
Use SetTimer to set up a timer and when the timer hits try to contact the server if the function fails then you know the server is gone.
Also take a look a connection points or IAdviseSink. You client can become an observer and the server will notify it when itis shutting down. This is the cleanest way.
I know you dont want to modify the server but it may be the most efficient solution.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
check out this article in MSDN. This explains how to catch an server event in the application...
HOWTO: Catch Microsoft Word97 Application Events Using VC++