Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Longer Task without waiting for completion
Message
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Miscellaneous
Thread ID:
00615250
Message ID:
00615318
Views:
13
Hi!

It is depended on the way you call this COM object. For example, imagine situation when you call the COM object to request a lengthy operation for it. After that in some other place in the program you try to call the COM object again to get another data and cannot, because COM object is busy working on previous task. As far as client application aware about such thing, no problem.

There are no otehr issues as far as I know.

>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
>
>
Vlad Grynchyshyn, Project Manager, MCP
vgryn@yahoo.com
ICQ #10709245
The professional level of programmer could be determined by level of stupidity of his/her bugs

It is not appropriate to say that question is "foolish". There could be only foolish answers. Everybody passed period of time when knows nothing about something.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform