Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Longer Task without waiting for completion
Message
 
To
All
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Title:
Longer Task without waiting for completion
Miscellaneous
Thread ID:
00615250
Message ID:
00615250
Views:
48
When I need to have longer tasks or scheduled tasks done by
a COM Server (EXE) and do not want to wait for completion,
normally do start a timer from within a StartProc and return
immediately. Within a few ms the timer starts and actually
Starts the process (see example below).

Good approach, bad approach, any other ideas?
DEFINE CLASS TEST as SESSION OLEPUBLIC
    o_tmrStart = .NULL.    
    
    PROCEDURE INIT
      .o_tmrStart = CreateObject("tmrCmd")
    ENDPROC && INIT


    PROCEDURE Start
     ....  
     public go_App
     go_App = This

     if .EverythingIsSet()
         .tmrStart.c_Cmd    = "go_App.TheLongerTask"
         .tmrStart.Interval = .tmrStart.n_Delay
         ll_RetVal = .T.
     else
         ll_RetVal = .F.
     endif

     return ll_RetVal

    ENDPROC && Start

    PROCEDURE DESTROY
      rele go_App
      .o_tmrStart = .NULL.     
    ENDPROC

ENDDEFINE  && tmrCmd

DEFINE CLASS tmrCmd as TIMER
    n_Delay = 20
    c_cmd   = ""

    PROCEDURE TIMER
     if this.Interval = 0
         return
     else
         This.Interval = 0
     endif

     lc_cmd = .c_cmd
     &lc_cmd
    ENDPROC

ENDDEFINE && tmrCmd     
Regards from Berlin

Frank

Dietrich Datentechnik (Berlin)
Softwarekombinat Teltow (Teltow)

Frank.Dietrich@dd-tech.de
DFPUG # 327
Next
Reply
Map
View

Click here to load this message in the networking platform