"Darren Brook" <D_Brook@btinternet.comwrote in message
news:3vCdnR_nm4RCFeTYnZ2dnUVZ8tuknZ2d@bt.com...
Quote:
Originally Posted by
Does anyone know how to create an ActiveX EXE Server that raises events
which can be captured by muliple clients?
>
|
I could post the sample code, but you might as well look at the article
yourself.
This is a link to Sharing the CoffeeMonitor, which is step 7 in the VB tutorial
on Creating an Activex Exe Component.
http://msdn.microsoft.com/library/e...ffeemonitor.asp
In summary, it says:
For two apps to both receive the events, they must get a reference to a shared
object, not each create their own new object.
To do this, you create a Connector class. Each app creates its own Connector
object, and the connector has a method for getting a reference to the one shared
RealClass object (the CoffeeMonitor in the example).
The real object is created when the first connector is created, and terminated
when the last connector is terminated. It is set to PublicNotCreatable, so that
each app is forced to use the Connector to get to it.
In each app, the code looks something like
Dim WithEvents RealObj As RealClass
Dim Conn As Connector
Set Conn = New Connector
Set RealObj = Conn.RealObject