Hi Dan,
Try this. Compile the following program into a COM MultiUse Server EXE with a project named DanC:
Define Class DanC as Custom OlePublic
Procedure Process(tcID,toOutput,tnTime)
toOutPut.Cls()
Local lnStart, lnStart2
lnStart = Seconds()
Do While lnStart+tnTime > Seconds()
lnStart2 = Seconds()
Do While lnStart2+1 > Seconds()
Enddo
toOutPut.Print( m.tcID+Str(Seconds(),10,3)+Chr(13) )
Enddo
toOutPut.Print( "E>"+m.tcID+Str(Seconds(),10,3) )
EndProc
Enddefine
Now open two instances of VFP and in the first run the following code:
ox = CreateObject("DanC.DanC")
ox.Process("1",_SCREEN,30)
wait until the COM server prints the first line and then issue the following code in a second instance of VFP:
ox = CreateObject("DanC.DanC")
ox.Process("2",_SCREEN,10)
You can see that the COM server prints the results in the first instance, then switches over to the second instances for 10 seconds, and finally continues in the first instance. In fact, if you check the value of PROGRAM(-1) you can see that the second instance is treated as a subprogram. The DO level is 1 for the first instance and 2 for the second instance.
Makes me wonder if you can use RETURN TO MASTER to cancel all processes. *g*
Christof
--
Christof