How to make ConnectionPoint in Delphi?

I am writing a DLL that talks to Excel through the IDispatch interface. From VBA I am passing in a variant containing Application.Caller

from which I draw the IDispatch pointer through .pDispVal

.

I would like to know how to request an interface using the IDispatch pointer. I want to set up a connection point container and from there find an Excel connection point. The end goal is to bind things to the Excel Calculate event and manipulate the Excel data.

0


source to share


2 answers


I would recommend Binh Ly's timelessly excellent (Delphi) COM tutorial at http://www.techvanguards.com/ , which includes chapters entirely devoted to IConnectionPoint

and related mechanisms
.

It also offers a free EventSink code generation tool.



However, I have a strong feeling that this is not necessary if all you want to do is react to an event raised by the Excel object Application

. Have you tried just using the wrapper objects that the Delphi type library importer generates for you? You can of course write your own wrappers.

Then I haven't written any addins for Excel yet, but I'm writing addins for Outlook and Word for life and Excel really shouldn't be that different in that regard.

+1


source


+1


source







All Articles