vimalalex
asked on
Connection points in ATL/COM
Hi experts,
How can we implement connection points COM. I have gone through some www.Codeproject.com articles about connection points but I not able to implement a sample app for connection points.I am using visual c++ 2008 IDE. I want to set a funtion from client app to the COM server and COM have to callback this function.
Regrads,
Vimal
How can we implement connection points COM. I have gone through some www.Codeproject.com articles about connection points but I not able to implement a sample app for connection points.I am using visual c++ 2008 IDE. I want to set a funtion from client app to the COM server and COM have to callback this function.
Regrads,
Vimal
ASKER
Hi DeepuAbrahamK,
Yes I have gone throught the above article.There they are creating a CSink class in client app for setting the callback function.Is there any method that we can directly give some function names.
Can you pease explain me the proper steps for implementing connection points is it necessary to implement a class in client side.
Regards,
Vimal.
Yes I have gone throught the above article.There they are creating a CSink class in client app for setting the callback function.Is there any method that we can directly give some function names.
Can you pease explain me the proper steps for implementing connection points is it necessary to implement a class in client side.
Regards,
Vimal.
What have you done so far and what are the results/errors?
Are you using an INPROC server?
Are you using an INPROC server?
ASKER
Hi ambience,
Thanks for your reply.I am using INPROC server.I have done a COM server dll which has a TestShow() function in the connection point class and Fire_TestShow() function in proxy class. How I can use this function in the client applicatioin.Do I need to implement any extra class in client application for setting the callback function TestShow().
Regards,
Vimal.
Thanks for your reply.I am using INPROC server.I have done a COM server dll which has a TestShow() function in the connection point class and Fire_TestShow() function in proxy class. How I can use this function in the client applicatioin.Do I need to implement any extra class in client application for setting the callback function TestShow().
Regards,
Vimal.
Yes you need to implement the Even Sink interface on a COM object in your client app. Further, after creating the server object you must fetch IConnectionPoint interface (query Interface) and do Advise() and pass it the interface of your sink object.
Check this out too http://msdn.microsoft.com/en-us/library/ms678815%28v=vs.85%29.aspx.
If you can paste the code where you create the server etc. then someone should be able to help easily.
Check this out too http://msdn.microsoft.com/en-us/library/ms678815%28v=vs.85%29.aspx.
If you can paste the code where you create the server etc. then someone should be able to help easily.
ASKER
Hi ambience,
Is there any easy way to create sink interface ie I mean any wizard or manually we need to type the entire code for sink inteface.
Regards,
Vimal.
Is there any easy way to create sink interface ie I mean any wizard or manually we need to type the entire code for sink inteface.
Regards,
Vimal.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hi ambience,
Thanks for your reply. I have implemented a COM Server and it is registered in my machine and it has a CLSID{....}.
Normally in a client app we will create the instance of the COM using the CLSID and we will use the interface pointer to invoke the COM methods.For implementing Connection point sink class as your above comment
"On the client side, you will have to import the tlb/dll.
After that you can create a regular MFC or ATL based object (using wizard I guess) that implements the interface."
Using which wizard in MFC application can I create a sink cass automatically.Please explain some more detail.
Regards,
vimal.
Thanks for your reply. I have implemented a COM Server and it is registered in my machine and it has a CLSID{....}.
Normally in a client app we will create the instance of the COM using the CLSID and we will use the interface pointer to invoke the COM methods.For implementing Connection point sink class as your above comment
"On the client side, you will have to import the tlb/dll.
After that you can create a regular MFC or ATL based object (using wizard I guess) that implements the interface."
Using which wizard in MFC application can I create a sink cass automatically.Please explain some more detail.
Regards,
vimal.
ASKER
Hi ambience,
Please reply for my last comment, if possible. I am not getting any response so I am closing the question
Please reply for my last comment, if possible. I am not getting any response so I am closing the question
Did you read this already?
http://www.codeproject.com/KB/COM/connectionpoint.aspx