> The class has an event called "OnDone" which is called whenever i call the "Go" method and it completes successfully.
>
> The documentation for the "OnDone" method show a list of defined parameters which i can use.
>
> My question is: How do i define my own code for the "OnDone" event so that i can process my own code each time the "Go" method completes successfully.
>
> What you need to do is create a custom handler class that implement the interface of your COM component that has the OnDone method. You can then write your code in the OnDone method of your handler class.
>
> You associate your handler class with the COM component using the EVENTHANDLER() function.
>
> See EVENTHANDLER() and DEFINE CLASS Command - IMPLEMENTS Clause in the on-line help.
>
> The easiest way to create your custom handler object is to open the COM object's type library in the object browser and then drag the appropriate interface into a prg. This will create a skeleon program for you that you can modify.
>
> Regards,
> Marcia G. Akins
> Tightline Computers, Inc.Thanks Marcia
I have played around with some code and this example below works great.
oMyObject = CREATEOBJECT("MYCOM.ClassName")
oevents = NEWOBJECT('ehandler')
EVENTHANDLER(oMyObject,oevents)
* insert my normal code for the object here
oMyObject.Go() &&this calls the "oMyObject.OnDone" event when complete
* Defined Classes
DEFINE CLASS ehandler AS session
IMPLEMENTS _IClassNameEvents IN "MYCOM.ClassName"
PROCEDURE _IClassName_OnSent(lRet As Number @, ErrDescription As VARIANT @, nKey As Number @, tParam As VARIANT @) as Logical
*here is my custom code for the OnDone event
*
ENDPROC
ENDDEFINE