Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Not a problem just wanted opinions.
Message
 
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Environment versions
Visual FoxPro:
VFP 6 SP5
OS:
Windows 2000 SP4
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01021285
Message ID:
01021321
Views:
14
Ken,

Just a couple of things...

The timer won't really be a separate thread your COM instance only has one thread. The timer will allow your call to return and then have the really called code execute sometime in the future. You can accomplish the same thing by doing a ShellExecute() since you aren't waiting for the spawned process to finish.
asjr = 0
I'd write the above line as
asjr = .null.
because it doesn't set the property to a numeric and then change it to an object reference later.

In your timer.Timer event you might want to tweak the code if these things you are calling take longer than the timer interval to execute:
PROCEDURE timer
 if this.CJobid != ""
  private Job && can delay the creation of these memvars
  private Inputfile
  private CPRG
  Job = this.CJobid
  Inputfile = this.CFile
*  PRG = this.CPRG && you can direct name substitute this without a private
  this.Enabled = .f. && prevent this timer from going off while the job executes
  do (this.CPRG)
  && reset set commands incase prg plays with them
  set exact on
  set ansi on
  set date to BRITISH
  this.CJobid = ""
  this.CFile = ""
  this.CPRG = ""
  this.Enabled = .t. && turn timer back on now that it's ready for another task
 endif
ENDPROC
>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.
df (was a 10 time MVP)

df FoxPro website
FoxPro Wiki site online, editable knowledgebase
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform