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:
01021367
Views:
13
Thanks I also noticed the private declarations could move just after posting, and I'll change the asjr to .null.

I also thought of the deactivate timer thing and I did have it in to start with. I had a few issues getting it to fire at all (nothing to do with this deactivating it turned out) but when I left it out I noticed the timer does not seem to fire again during a long prg anyway. I guess this is a thread thing. I'll still put it in for completeness.

The timer is another object created by the COM and does seem to have it's own thread, if I make prg that the timer runs into a 10second loop I can still call functions in the ApJobRun class, infact I do. It'll instantly return a .F. indicating it is busy running a job and I can move on and try another instance. Surely if both timer and ApJobRun were on the same thread it would not be able to respond until that prg had finished? I'd be interested in knowing how it is working if it's not in another thread.

I use ShellExecute() for a few things but it does not suit this case as I do pass messages back and forth as part of the bigger system (I posted a simplified version). I also have this COM object registered on remote machines and using this method I can spread the load of processing jobs, I dont think it's possible to start programs on remote machines with Shellexecute().

Thanks for the advice.

Ken.


>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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform