Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Not a problem just wanted opinions.
Message
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Title:
Not a problem just wanted opinions.
Environment versions
Visual FoxPro:
VFP 6 SP5
OS:
Windows 2000 SP4
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01021285
Message ID:
01021285
Views:
84
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 != "" && if we have a job running, return .F. ie busy
 return .F.
endif
this.asjr.CJobid = inJob
this.asjr.CFile = inFile
this.asjr.CPRG = inPRG
return .T. && job accepted

ENDPROC

ENDDEFINE


DEFINE CLASS jobruntimer AS Timer

&& PRG needed vars
&& make them private in timer event so the prg should also see them
CJobid = ""
CFile = ""
&& Actual PRG name and Timer interval (5 seconds)
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)
  && reset set commands incase prg plays with them
  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.
Next
Reply
Map
View

Click here to load this message in the networking platform