Click to See Complete Forum and Search --> : Events


jerbom
September 26th, 2001, 08:42 AM
Iīm going to build a Com-object (ActiveX-dll) with interfaces. How did I manage the events? (The implements feature does not support outgoing interfaces)
Thanks for help!

DSJ
September 26th, 2001, 09:21 AM
Here's a very simple example that should help get you started.

In a form module:

option Explicit
Dim withevents x as Class1
private Sub Form_Load()
me.Show
set x = new Class1
x.RunObject
End Sub

private Sub x_MyEvent()
MsgBox "Event Fired"
End Sub




In a class module:

option Explicit
public Event MyEvent()

public Sub RunObject()
Dim x as Long
for x = 1 to 10000
DoEvents
next
RaiseEvent MyEvent
End Sub

jerbom
September 26th, 2001, 11:59 AM
My question was a bit short.
I have a IClass (interface) for the ingoing (properties and sub/function) and like to have a outgoing interface for the events (IClassEvent).
I have a Class module where I Implement my IClass for the methods and properties. I declare my Event Public and Raise the Event.

Then from the Client I like to declare two variables.

[Private WithEvents mp_ClassEvent As Class
Private mp_Class As IClass]

and then Instantiate them.

[Set mp_Class As Class
Set mp_ClassEvent As Class]

But the events didnīt fire.