Re: getting an event handler from a active-x dll dispinterface
- From: HanslH <no@xxxxx>
- Date: Wed, 27 Dec 2006 12:02:27 +0100
Thanks to your reply I was able to solve it. It gave me the idea that
essentially I was doing the right thing but there was a detail going
wrong.
The detail was that in the connect method I had to typecast the
com-object parameter to its parent class.
(But still the event object connects to the com-object in stead of the
other way around.)
On Tue, 26 Dec 2006 10:46:51 +0100, "Maarten Wiltink"
<maarten@xxxxxxxxxxxxxxxxxx> wrote:
"HanslH" <no@xxxxx> wrote in message.
news:v7i0p2p9c28ilh3rtce3mpu0jedir0o5mk@xxxxxxxxxx
I used EventSinkImp to create a component based on the event-object.
The component is only very simple, it just has the youhaveamessage
event and name and tag property in the object inspector.
Why a TComponent? Any object would do.
The event is not fired on incoming messages when i create an object
(which is logical since not even a port is opened or whatever).
The other class of which I did succesfully create an communication
object does have an openport, sendmessage,getmessage function. So one
way or the other I have to connect the two.
The event object-class has a connect method:
Connect (const ASource: IUnknown);
I don't know what an IUnkNown is
It's the TObject of interfaces, from which all other ones derive.
It allows having a single Connect method. The receiving object will
check that the interface supplied is of the right type, and only
fire events through it if it is.
Some strong type-checking is lost there, as you've found out.
but if I use the (connected and functioning) communcation object
as a parameter it does compile, it does run but it doesn't fire
events.
Calling a method on the event sink object to connect the source?
Odd. I would have expected the source (the communication object)
to have a method to pass the event sink object('s interface) to.
I know i display utter ignorance here. I don't want to become an
activeX expert.
No, you don't. I know too much about it for my own happiness.
Groetjes,
Maarten Wiltink
- References:
- getting an event handler from a active-x dll dispinterface
- From: HanslH
- Re: getting an event handler from a active-x dll dispinterface
- From: Maarten Wiltink
- Re: getting an event handler from a active-x dll dispinterface
- From: HanslH
- Re: getting an event handler from a active-x dll dispinterface
- From: Maarten Wiltink
- getting an event handler from a active-x dll dispinterface
- Prev by Date: Re: Delphi problem with Laptop
- Next by Date: Re: local to screen
- Previous by thread: Re: getting an event handler from a active-x dll dispinterface
- Next by thread: Re: getting an event handler from a active-x dll dispinterface
- Index(es):
Relevant Pages
|