Board index » delphi » translation of vb "withevents"

translation of vb "withevents"

I have seen a few questions on this list regarding automation events, which
all stayed unanswered.  I suppose that it concerns something nobody has been
able to hack into so far, but I am suffering the same problem.  So, all you
guru's out there.  There is a nice question here.

I am trying to automate Outlook (2000) using an add-in.  The add-in needs to
implement some events created by Outlook, and there's the problem.  I use
the Explorer Interface to connect to the active Explorer, but then I should
also implement the ExplorerEvents dispinterface.  But I haven't got a clue
how to go about that.
The problem is that the Type Library imported from Outlook only gives a
dispinterface.
Any ideas how to link those explorerevents to the Explorer object I created?

In VB, you only should declare
dim oExplorer withevents as IExplorer
and everything is taken care off.  If I don't find the solution now, I will
have to consider changing to VB to implement it and that is what I have been
trying to avoid for a few years now.  Please stop me from doing so!

Thanks in advance,

Lieven Bogaert
lie...@eNetricity.com

 

Re:translation of vb "withevents"


This isn't much help I'm afraid, I know what you need to implement I simply
haven't had the time to try it out myself (I was investigating asynchronous
database access with ADO and that also requires events). Anyway, I hope this
helps you out...

Com Events are called "sinks" and are managed by an IConnectionPoint
interface.

I'll quote MSDN:

"Sink - A COM object that acts as the physical delivery destination for the
results of an asynchronous operation or an event notification. "

So there ya go, straight from the horses mouth!

The ConnectionPoint interface has an Advise method which I believe it used
to attach the 'sink' to other COM objects.

If you have access to MSDN, search for the phrase "ADO Event Instantiation
by Language".

This is of course for ADO but shows you what is required to 'turn on' events
for a COM Object (the examples are in VB and C++ and shows how to attach
events to the ADO objects).

Hope this helps and gives you a few pointers...

Oh, and if you manage to get it working, let me know how you did it (to save
me working it out for myself <grin>)

Good Luck

Simon Whelband
AnswerSets
simon_whelb...@answersets.com

Re:translation of vb "withevents"


On Mon, 7 Jun 1999 15:09:59 +0200, "Lieven Bogaert"

Quote
<lie...@eNetricity.com> wrote:
>I have seen a few questions on this list regarding automation events, which
>all stayed unanswered.  I suppose that it concerns something nobody has been
>able to hack into so far, but I am suffering the same problem.  So, all you
>guru's out there.  There is a nice question here.

>I am trying to automate Outlook (2000) using an add-in.  The add-in needs to
>implement some events created by Outlook, and there's the problem.  I use
>the Explorer Interface to connect to the active Explorer, but then I should
>also implement the ExplorerEvents dispinterface.  But I haven't got a clue
>how to go about that.
>The problem is that the Type Library imported from Outlook only gives a
>dispinterface.
>Any ideas how to link those explorerevents to the Explorer object I created?

There's this marvellous chap called Binh Ly who has figured this stuff
out - take a look at http://www.castle.net/~bly/Programming/Delphi/ -
it even has examples, including one for Outlook 98 - near enough? :)

Re:translation of vb "withevents"


This site has some useful example code...

http://www.castle.net/~bly/Programming/Delphi/index.html

Quote
-----Original Message-----
From: Simon Whelband [mailto:simon_whelb...@answersets.com]

Posted At: 09 June 1999 15:33
Posted To: oleautomation
Conversation: translation of vb "withevents"
Subject: Re: translation of vb "withevents"

This isn't much help I'm afraid, I know what you need to implement I
simply
haven't had the time to try it out myself (I was investigating
asynchronous
database access with ADO and that also requires events). Anyway, I hope
this
helps you out...

Com Events are called "sinks" and are managed by an IConnectionPoint
interface.

I'll quote MSDN:

"Sink - A COM object that acts as the physical delivery destination for
the
results of an asynchronous operation or an event notification. "

So there ya go, straight from the horses mouth!

The ConnectionPoint interface has an Advise method which I believe it
used
to attach the 'sink' to other COM objects.

If you have access to MSDN, search for the phrase "ADO Event
Instantiation
by Language".

This is of course for ADO but shows you what is required to 'turn on'
events
for a COM Object (the examples are in VB and C++ and shows how to attach
events to the ADO objects).

Hope this helps and gives you a few pointers...

Oh, and if you manage to get it working, let me know how you did it (to
save
me working it out for myself <grin>)

Good Luck

Simon Whelband
AnswerSets
simon_whelb...@answersets.com

Other Threads