Dll component with events


I have a third-party activeX component for wich I need to handle events and the documentation shows a VB-example.

Public WithEvents mainApplicationObject As thirdPartyDll.Application

what is the Xojo equivalent for this WithEvents?

Have you tried adding the component to your project? Those events may already get created for you (it depends largely on the control, but I always suggest trying that first).

When I subclass the Application class
I can add any of the required event handlers to that subclass.

However using the code above the DLL will always return an instance of the original base class instead of the subclass.
I need a way to tap into the events that the base class provides.

As Greg asked, have you used the “Insert>ActiveX Component” menu option in Xojo? See this page at the bottom. If this works, Xojo will create a module with Xojo classes representing the ActiveX classes. It is really cool.

Yes I did,

And all classes work as expected, I can see all methods, event definitions etc…
However in need a place to put the code for my event handlers in and
the base class of the com-tree is created from code (see above)

Right. Now you either subclass the control or drag a copy to a window and implement the events there.

It isn’t an ActiveX-control but an activex reference ( chosen from the second tab).

And the root object of the (d)com-tree is created by calling the factory method above.
This factory method allways returns an ‘Aplication’-object never a subclassFromApplication-object.
Wouldn’t know ho to change that.

What am I missing here?

when it was created, did you end up with a module or a class?

In de IDE when I added the activeX reference you mean?
The entire dll shows up as a module with all the classes in it. Just like brandon said.

Bu then in code I need to create a root object of class “Application” from which all other things are derived using dot notation.

dim projectName As String = mainApplicationObject.program.project.name

This root object was created like this

Dim  mainApplicationObject As thirdPartyDll.Application = ThirdPartyDll.mainObject  // This is factory method of the DLL

furthermore since mainApplicationObject is of type thirdPartyDll.Application it will also generate events, I just have no idea how to handle them. I know when I create a subclass of thirdPartyDll.Application I can add the event handlers to that subclass.
However the factotymethod above will always return a plain old Application-object not a subclassFromApplication-object.

i’m stumped