How best for dll to "report progress"?



I have an activex dll that runs "in process" in another app
Dim oApp as ExternalApplication
Set oApp = CreateObject("AppName")

Set cWidget = oApp.GetInterfaceObject("DllName.WidgetClass")

The dll is created, lets say, by a form in a stand alone exe, therefore "out
of process" to the dll.class and other oApp

now cWidget.GetData examines a bunch of objects in oApp
It's a long running process and I want to show progress, eg a progbar or
whatever in the "calling" form/exe
and also allow a "cancel operation" facility in case user changes mind...<g>

I assume the way is to use events to report back on progress? (which i have
only a tiny understanding of)
Is that the right way to do it?
or is raising an event with each operation across process boundary an
expensive time consuming thing in itself?
would including events actually slow the thing down even more than it
already is???

so inside the cWidget class
Public Event CheckedAnotherOne()
Public Function GetData() as Boolean
For Each Obj in oApp.Objects
Do Events
If Not mbCanceled Then
Call Process (Obj)
Raise Event CheckedAnotherOne ???
Else
'stop because user hit cancel button on form or whatever...
End If

Next Obj
End Function
Public Sub CancelOp()
mbCancelled = True
End Sub

Then if cWidget is created in a form
Form Code:
Dim With Events cWidget As dllName.WidgetName
'then i think create an event handler something like:
Sub cWidget_CheckedAnotherOne()
Call IncrementProgressBar
End Sub
'and in Cancel Command Button
Sub Cancel_Click()
cWidget.CancelOp
End Sub


Is that the general idea?
am i even close?
better ways?

Thanks for any input
Mark


.


Loading