Getting Events out of a non visual ActiveX control - am I doing it right?

Getting Events out of a non visual ActiveX control - am I doing it right?

Post by Tim » Wed, 21 Mar 2007 00:59:59

Hi guys,

I'm quite new to the ActiveX side of Dolphin. I've played around with generating
wrappers etc, and have seen things working quite well. Recently I tried out
a reporting control (which is suprisingly non visual - but thats another

Anyway, I generated wrappers for the control and everything worked fine,
I could loop through my data and send report lines to the activeX control
and it would generate a report window for me. Cool!

However, there is a bit of the control that can generate events for the page
footer and header and this is where I got a bit unstuck.

In VB they give the example:

Option Explicit
Private WithEvents m_objReport As Report

Private Sub m_objReport_PrintFooter()

' Handle change event here.
End Sub

And so for my control I tried lots of permutations (different event names
with and without _ etc, using a name mentioned inside the instance of the
report object - _Report) of:

myReport when: #m_objReport_PrintFooter send: #footer to: self

I couldn't get any of it to work, it just did nothing. Browsing around here
I hit on the some code talking about AXEventSink. From what I can gather
it seemed like I didn't get any Event Sink stuff generated (myabe because
the control is non visual?).

Anyway I found other code using AXEventSink and implemented the following
methods - but am wondering if I have done this the correct way (this is mostely
a direct copy from AXEventSink)? Basically in my #initialize I connect up
a sink, and in my #free I disonnect the sink. I now seem to be able to use
#PrintFooter as an event name (and adding it to the #publishedEventsOfInstances
method makes it easy for me to remember the event names).

Does this seem like the correct and safe approach - or are there any other
little details I have to think about?


"Private - Wire up an <AXEventSink> to the control's default event interface,
and set it up to trigger
events off the receiver's presenter when they arrive from the control."

| tiSink unk |
sink := nil.
unk := self reportControl.

tiSink := (unk coclassTypeInfoIfNone: [])
ifNotNil: [:coclass | coclass defaultSourceInterface].
tiSink isNil ifTrue: [^self].

sink := AXEventSink target: self sourceTypeInfo: tiSink.
isTracingEnabled: false;
connect: unk

"Private - Disconnect the event sink (if any)."

sink isNil ifTrue: [^self].
sink disconnect.
sink := nil

super free.
self disconnectSink

... (initialisation stuff in here)
self connectSink.

1. Getting activex control event from ActiveX control.

2. Recieving events from an activeX control hosted in a composite control in Visual C++ (.Net 2003)


I have an ATL server that I want to upgrade from Visual C++ 6.0 to Visual
C++ 7.1 (.Net 2003).

The ATL server contains a single composite control that hosts an activeX
control. I used the ATL wizard to create it. The activeX control fires
several events (such as On Mouse down etc).

I have created some message handlers for those events to do stuff. This all
works fine in Visual C++ 6.0. When I import it to Visual C++ .Net I no
longer recieve any events. I have tried this with several active X controls
(such as the Microsoft ImageCombo control) they all work fine in version 6.0
but not with .Net. I have had a look at some of the knowledge base articles,
such as Q237771 and Q241810.

Does anyone have any ideas?



3. Importing ActiveX control, what am I doing wrong?

4. Activex control events not firing or ActiveX composite control not listening

5. Hooking up an event sink in VC++7.0 app from non-visual ActiveX ct

6. A trivial problem with Tk, I am sure I am not doing it the right way

7. non visual activeX controls?

8. Getting Key Events for an IE ActiveX Control

9. Getting events from an ActiveX control in JavaScript

10. My I's are coming up i's. (lower case)

11. Getting events from an ActiveX control in a C# winform..

12. Getting COM events from custom ActiveX control

13. How to get item object while getting right click event in the list control ??

14. ActiveX Control - Visual C++ 6.0 to Visual Studio 2008 (C++ )

15. Visual C++ ActiveX Control for Hosting InfoPath documents in Visual Basic or HTML