>Good afternoon
>
>I have two class definintions in the same program file, one of which is a timer. When the timer event fires, it calls a method in the first class, which fails. VFP complains it cannot find the called method of a public class, created from an exe ("Object oObjTestCom Not found").
>
>When oObjTestCom is created from the prg file, everything works perfectly.
>
>oObjTestCom = CREATEOBJECT("MyTestCom")
>
>
>But, when compiled into an exe named "MyComExe" and called like this:
>
>oObjTestCom = CREATEOBJECT("MyComExe.MyTestCom")
>
>The Object is created, Proc1, Proc2 and ProcCreateTimer all work.
>BUT, when the oMyTimer event fires, VFP errors, complaining it
>cannot find oObjTestCom.
>
>The code below is abbreviated, and I am hoping that someone will be able to spot the problem straight away. Thanks for taking the time to look.
>
>Thanks !
>Don Lowrey
>
This global programming is not very good.
Put the object reference into the timer object.
>
>File MyTestCom.prg has this (psuedo) code:
>
>Define MyTestCom AS Custom OlePublic
>Procedure Init
> This.CreateTimer
>EndProc
>Proc1..does stuff..EndProc
>Proc2..does other stuff..EndProc
>Procedure CreateTimer
> * Tried variations with and without declaring PUBLIC oMyTimer
oMyTimer = CREATEOBJECT("MyTimer",m.oObjTestCom)
>EndProc
>EndDefine
>
>Define Class MyTimer As Timer
> Set Enabled .t. and Interval to an int val, such as 30000
oCom = .NULL.
PROCEDURE Init(oCom)
this.oCom = m.oCom
> Procedure Timer
this.oCom.Proc2
> EndProc
>EndDefine
>
>
>Notes: When running from the executable:
>a. We know the class MyTimer gets created because the Timer event fires.
>b. However, from the VFP Object Browser, only the MyTestCom class is shown.
>c. In the DeBug window, oObjTestCom is shown as an object, but the Methods are not exposed. Also oMyTimer is not shown.
>d. We know the exe is running, because it is shown in the Task Manager, Processes Tab.
>*