From: Saga on
Hello all. On this occasion I would like to get your opinion on how best
approach a specific design requirement.

The VB2008 app that I am developing uses a legacy ActiveX EXE
server to return some data. The code instantiates the server object
and runs it. When the server is done it fires an event in the calling
code. Since it is asyn-chro-nous** the code after calling the server simply
keeps executing after the server begins processing.

Currently, the app is executed, the server started and then the app exits. I
need to keep the app alive while the server is running so that there is
something there when it finishes processing and fires the event. One idea
is to implement a service that is always running.

Is this the best way to do this? I had originally envisioned a console app,
running from Main(), doing the work, calling the Active X EXE and then
exiting, but I do not know how to keep the app from terminating before
the server is done and fires the event. I want to avoid a do-nothing loop
that polls some flag that is set when the ActiceX EXE's event fires,
looking for a better way.

One requirement is that the app needs to be able to run when the user
is log.ged out, so it can't be a typcal forms app.

Any ideas, recommendations, further reading references or feeback is
welcomed. Thanks! Saga

** I had to hyphen this word because for some reason, if I leave it
whole, the post is censored and does not go through. Go figure!


From: Family Tree Mike on
On 4/21/2010 5:44 PM, Saga wrote:
> Hello all. On this occasion I would like to get your opinion on how best
> approach a specific design requirement.
>
> The VB2008 app that I am developing uses a legacy ActiveX EXE
> server to return some data. The code instantiates the server object
> and runs it. When the server is done it fires an event in the calling
> code. Since it is asyn-chro-nous** the code after calling the server simply
> keeps executing after the server begins processing.
>
> Currently, the app is executed, the server started and then the app exits. I
> need to keep the app alive while the server is running so that there is
> something there when it finishes processing and fires the event. One idea
> is to implement a service that is always running.
>
> Is this the best way to do this? I had originally envisioned a console app,
> running from Main(), doing the work, calling the Active X EXE and then
> exiting, but I do not know how to keep the app from terminating before
> the server is done and fires the event. I want to avoid a do-nothing loop
> that polls some flag that is set when the ActiceX EXE's event fires,
> looking for a better way.
>
> One requirement is that the app needs to be able to run when the user
> is log.ged out, so it can't be a typcal forms app.
>
> Any ideas, recommendations, further reading references or feeback is
> welcomed. Thanks! Saga
>
> ** I had to hyphen this word because for some reason, if I leave it
> whole, the post is censored and does not go through. Go figure!
>
>

It would seem you could create a timer that simply ticks every second or
so while your code is waiting for the event from the server. Once the
server event is handled, disable the timer. I may be oversimplifying
your problem though.

--
Mike
From: Saga on
Thanks for your reply.

> I may be oversimplifying your problem though.

Maybe, but it is worth a try to see the result. I will follow up when I test
your suggestion. Saga



"Family Tree Mike" <FamilyTreeMike(a)ThisOldHouse.com> wrote in message
news:O4oDEHo4KHA.5464(a)TK2MSFTNGP05.phx.gbl...
> On 4/21/2010 5:44 PM, Saga wrote:
>> Hello all. On this occasion I would like to get your opinion on how best
>> approach a specific design requirement.
>>
>> The VB2008 app that I am developing uses a legacy ActiveX EXE
>> server to return some data. The code instantiates the server object
>> and runs it. When the server is done it fires an event in the calling
>> code. Since it is asyn-chro-nous** the code after calling the server
>> simply
>> keeps executing after the server begins processing.
>>
>> Currently, the app is executed, the server started and then the app
>> exits. I
>> need to keep the app alive while the server is running so that there is
>> something there when it finishes processing and fires the event. One idea
>> is to implement a service that is always running.
>>
>> Is this the best way to do this? I had originally envisioned a console
>> app,
>> running from Main(), doing the work, calling the Active X EXE and then
>> exiting, but I do not know how to keep the app from terminating before
>> the server is done and fires the event. I want to avoid a do-nothing loop
>> that polls some flag that is set when the ActiceX EXE's event fires,
>> looking for a better way.
>>
>> One requirement is that the app needs to be able to run when the user
>> is log.ged out, so it can't be a typcal forms app.
>>
>> Any ideas, recommendations, further reading references or feeback is
>> welcomed. Thanks! Saga
>>
>> ** I had to hyphen this word because for some reason, if I leave it
>> whole, the post is censored and does not go through. Go figure!
>>
>>
>
> It would seem you could create a timer that simply ticks every second or
> so while your code is waiting for the event from the server. Once the
> server event is handled, disable the timer. I may be oversimplifying your
> problem though.
>
> --
> Mike