Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 169
  • Last Modified:

COM Doubt(urgent)


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. )

1 Solution
Hi ,

 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++
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.
PAQed - no points refunded (of 50)

Community Support Moderator

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now