Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Not a problem just wanted opinions.
Message
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Classes - VCX
Titre:
Not a problem just wanted opinions.
Versions des environnements
Visual FoxPro:
VFP 6 SP5
OS:
Windows 2000 SP4
Database:
Visual FoxPro
Divers
Thread ID:
01021285
Message ID:
01021285
Vues:
83
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.
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform