Information générale
Catégorie:
COM/DCOM et OLE Automation
I think we've got it.
The problem was in the communication between the timer class and the class that does the work.
Dragon, Rick and Fabio both noted a problem with my global object approach. The light bulb finally went on when I studied the thread that Sergey mentioned.
Thank you all for your insights.
The solution was in making a assignment of the Timer object to a propery of the work class. I had been creating the timer object and then made a direct call to a method of the work class.
******
Define the class that does the work, then Declare a property for that class
loTimer = NULL
Create the timer object, and store a reference to the object in THIS.loTimer. Pass a work class object reference as a parameter to the timer class.
PROCEDURE INIT
THIS.loTimer = CREATEOBJECT("MyTimer",THIS)
* Not this way: oMyTimer = CREATEOBJECT("MyTimer")
ENDPROC
*****
Define the Timer Class, then declare a property in the Timer class
loParent = NULL
PROCEDURE INIT
LPARAMETERS oParent && oParent is the passed in reference to the work class
THIS.loParent = oParent
ENDPROC
* Now we can call a method in the work class
PROCEDURE Timer
This.loParent.Proc1() && Do something in a method of the work class
* Not this way: oWorkClass.Proc1()
ENDPROC
Précédent
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement