Looks like a good use of a timer to me. I've used COM servers with timers in the past to accomplish things similar to this. It's ingenious really if one stops to think about it. I used an approach similar to this in the COM Server progress bar that I put in the FAQ area on this forum. It allows the progress bar to continue smoothly showing eye candy for the user while they wait for a task of indeterminate length to finish. Just create the COM object from my app, it kicks on the timer and returns control to my app immediately. My app is free to do other things, while the COM object is on auto-pilot via the timer. I think what you did is great Ken.
>and confimation that you don't think I'm doing anything terrible here.
>
>I've put together my code for running a bunch of old prg's that run jobs, I have a program that creates 3 EXE COM objects bassed on session (single use so they are all running separately) the class for these objects creates a timer in the init (so the timer gets it's own thread). From the main program I can then send job requests, the COM class fills in info in the timer class, the timer kicks in and runs the prg and everything stays responsive. I use the timer so that there is no chain of waiting for a function to return.
>
>it all seems to work perfectly, I guess I just wanted to check you you all knowing types that I'm not going the wrong way about this.
>
>so heres the job running class/s,
>
>
>DEFINE CLASS ApJobRun AS session OLEPUBLIC
>
>asjr = 0
>
>PROCEDURE init
> set exact on
> set ansi on
> set date to BRITISH
> this.asjr = createobject("jobruntimer")
>ENDPROC
>
>PROCEDURE asRunjob(inJob,inFile,inPRG)
>if this.asjr.Cjobid != ""
> return .F.
>endif
>this.asjr.CJobid = inJob
>this.asjr.CFile = inFile
>this.asjr.CPRG = inPRG
>return .T.
>
>ENDPROC
>
>ENDDEFINE
>
>
>DEFINE CLASS jobruntimer AS Timer
>
>
>
>CJobid = ""
>CFile = ""
>
>CPRG = ""
>Interval = 5000
>
>PROCEDURE timer
> private Job
> private Inputfile
> private CPRG
> if this.CJobid != ""
> Job = this.CJobid
> Inputfile = this.CFile
> PRG = this.CPRG
> do (PRG)
>
> set exact on
> set ansi on
> set date to BRITISH
> this.CJobid = ""
> this.CFile = ""
> this.CPRG = ""
> endif
>ENDPROC
>
>ENDDEFINE
>
>
>and to test I had a PRG which would bring up a messagebox with the job variable, which I started from the 3 COM obejects. Again like I said it all works great, I just wanted to open it up to creative criticism/ positive ideas. I'm going to have the COM EXE fire up on 3 different processing machines so the effort of running the jobs is shared.
>
>Thats it, thanks.
>
>Ken.