Event source and sink for COM without ATL or MFC 
Author Message
 Event source and sink for COM without ATL or MFC

Hi,

I'm writing a COM object without the use of ATL or MFC.
Only problem are events.
How do I write the event source code in c++ (maybe some windows API's)?
Once the source is implemented, the sink should not be too difficult..
Anyone knows where I can find more information about this subject?

Thanks,

Patrick



Tue, 14 Dec 2004 22:13:19 GMT  
 Event source and sink for COM without ATL or MFC
You need to implement IConnectionPointContainer container on your
object, and a separate object implementing IConnectionPoint for each
outgoing interface you plan to support. The interfaces are pretty
straightforward.
--
With best wishes,
    Igor Tandetnik

"For every complex problem, there is a solution that is simple, neat,
and wrong." H.L. Mencken


Quote:
> Hi,

> I'm writing a COM object without the use of ATL or MFC.
> Only problem are events.
> How do I write the event source code in c++ (maybe some windows
API's)?
> Once the source is implemented, the sink should not be too difficult..
> Anyone knows where I can find more information about this subject?

> Thanks,

> Patrick



Tue, 14 Dec 2004 22:25:06 GMT  
 Event source and sink for COM without ATL or MFC
Patrick,

We have an article on our website about sinking connection points without
using ATL or MFC. It's pretty straight forward stuff  but the template class
that we developed makes it even easier.

http://www.jetbyte.com/portfolio-showarticle.asp?articleId=40&catId=1...
Id=3

--
Len Holgate
http://www.jetbyte.com
The right code, right now.
Contract Programming and Consulting Services.



Tue, 14 Dec 2004 22:41:06 GMT  
 Event source and sink for COM without ATL or MFC
And two more objects implementing IEnumConnectionPoints
and IEnumConnections respectively. Also straightforward.

The best explanation of Connectable Objects (aka connection
points) may be found in chapter 4 of "Inside OLE" by Kraig
Brockschmidt (unfortunately, long since out of print...).

--
=====================================
Alexander Nickolov
Microsoft MVP [VC], MCSD

MVP VC FAQ: http://www.mvps.org/vcfaq
=====================================

Quote:

> You need to implement IConnectionPointContainer container on your
> object, and a separate object implementing IConnectionPoint for each
> outgoing interface you plan to support. The interfaces are pretty
> straightforward.
> --
> With best wishes,
>     Igor Tandetnik

> "For every complex problem, there is a solution that is simple, neat,
> and wrong." H.L. Mencken



> > Hi,

> > I'm writing a COM object without the use of ATL or MFC.
> > Only problem are events.
> > How do I write the event source code in c++ (maybe some windows
> API's)?
> > Once the source is implemented, the sink should not be too difficult..
> > Anyone knows where I can find more information about this subject?

> > Thanks,

> > Patrick



Wed, 15 Dec 2004 01:34:57 GMT  
 Event source and sink for COM without ATL or MFC
Patrick,

There is a COM Tutorial sample which shows manually implementing  
connection points - you can get the actual sample code with platform sdk.

http://msdn.microsoft.com/library/en-us/vcsample98/html/vcsmpconserve...
ablecomobjectsinin-processserver.asp?frame=true

http://msdn.microsoft.com/library/en-us/vcsample98/html/vcsmpconclien...
fconnectablecomponents.asp?frame=true

Hope this helps.

Krishnan Rengasamy
Microsoft Developer support

This posting is provided AS IS with no warranties, and confers no rights.

--------------------

| Subject: Event source and sink for COM without ATL or MFC
| Date: Fri, 28 Jun 2002 16:13:19 +0200
|
| Hi,
|
| I'm writing a COM object without the use of ATL or MFC.
| Only problem are events.
| How do I write the event source code in c++ (maybe some windows API's)?
| Once the source is implemented, the sink should not be too difficult..
| Anyone knows where I can find more information about this subject?
|
| Thanks,
|
| Patrick



Wed, 15 Dec 2004 06:16:42 GMT  
 Event source and sink for COM without ATL or MFC
Thanks all, especially the Microsoft links were great.
Turns out there are some great COM tutorials in plain c++ in the Platform
SDK
With loads of sample code..

I'm happy guy now...;)



Fri, 17 Dec 2004 16:41:45 GMT  
 Event source and sink for COM without ATL or MFC
Quote:

> Hi,

> I'm writing a COM object without the use of ATL or MFC.
> Only problem are events.
> How do I write the event source code in c++ (maybe some windows API's)?
> Once the source is implemented, the sink should not be too difficult..
> Anyone knows where I can find more information about this subject?

"Inside COM" by Rogerson is a great book. Now, that aside, from personal
experience - don't even use any "connection points", it's an unnecessary
mechanism. Simply create an object where your events are needed, and give an
instance of that object to the code where the events happen, so it can, sorta,
"yank the chain" into the user code. That's all, functionally it's just the same
as connection points and you don't need to{*filter*}with the "standard" mechanism.
It's limiting and you need to learn how to use it, whereas neither one is
necessary in practice. Straight COM objects will do the job.


Tue, 21 Dec 2004 04:57:54 GMT  
 
 [ 7 post ] 

 Relevant Pages 

1. COM client (MFC) using ATL to sink events ?

2. ATL DLL event sink with a VB ActiveX DLL event source

3. ATL COM Component firing events into VBScript event sink

4. Event Sink for a COM object which raises events - Proof of Concept

5. Problem with ATL Sink class for catching another ATL's events

6. Problems with ATL COM event with BSTR arg in MFC

7. Catching ATL based COM events from MFC apps

8. ATL - sink event

9. Dynamic Event Sink In ATL?

10. Implementing Event Sinks in ATL

11. ATL Event Sink (DISP_E_MEMBERNOTFOUND)

12. ATL event sink

 

 
Powered by phpBB® Forum Software