Re: Threads in Visual Basic?



Yup! :-)

The important thing about that example Dag is that the ActiveX EXE thread
executes asynchronously with respect to the caller (achieved by scheduling a
single-shot timer for a very short time after the call). Normally, a COM
call to the ActiveX EXE will block until that call returns. This little
trick allows it to operate asynchronously until it delivers an Event back to
the caller, as you suggested.

Tony Proctor

"Dag Sunde" <me@xxxxxxxxxxxx> wrote in message
news:462f758a$0$31540$8404b019@xxxxxxxxxxxxxxxxxx
Ray wrote:
Tony Proctor wrote:
That's possible Ray. The not-so-obvious bit is how to share the
loaded data later. As I said, the threads are independent in almost
every way, and share no data by default. If you were to pass the
resulting Recordset via a COM call between threads (or processes)
then it could also take a long time. Do you know why the database
loading
is so slow? How much data are
you talking about?

Tony Proctor


It's not that much data, it's just coming over a slow WAN link, which

I'm just looking for an example or two of how to do a "background"
process in VB so the user could start to log in to the app while the
data continues to load.

Instead of making them start at a splash screen or hourglass for a
minute, I'd like the data to load in the background while they log in.

This is quite possible with an activeX exe (out-of-process) server that
loads the data, and raises an event when done.

Instance it "withevents", and your app will be notified when data is
available.

(If I remember correctly, the "CoffeeTimer" example in the VB manual
show an example of this).

If you can't grok it, post a note here, and I'll whip something together
for you... (but give it a try first... (deadlines haunt me these days)).


The best I could think of would be to use a timer and a status flag to
make sure the data load only runs once, but then I still have a timer
running every x seconds doing nothing other than going "yup, already
ran..."

That is easily fixed by setting Timer1.Enabled = False once you're done.

--
Dag.




.



Relevant Pages

  • Re: Instantiation
    ... I have an array of class that instantiates one each of the ActiveX EXE. ... api timer message is intercepted, object retrieved and real implementation called... ...
    (microsoft.public.vb.general.discussion)
  • Re: The best way to yield processor to other users for long-runnin
    ... What is IIRC? ... the ActiveX EXE, why in my case it does not return from the ActiveX EXE to ... What did you mean by Tickevent handler of the timer? ... (this means my application receives a request from a client). ...
    (microsoft.public.vb.general.discussion)
  • Re: The best way to yield processor to other users for long-runnin
    ... Did you mean in my ACtiveX exe put a timer with an interval of 1, ... By simply setting up a timer and getting out of the method, control is returned back to whatever called it ... > processing the request leaving your main application free to respond to user input or other requests. ...
    (microsoft.public.vb.general.discussion)
  • Re: I need an idea for a vbModal form trick please.
    ... >> I can use SetWindowPos to make it the top most form but I can't load the ... >> I have thought of building a separate application just for the search ... >> facility and then shelling it but then the user may end up loading more ... > ActiveX EXE. ...
    (microsoft.public.vb.com)
  • Re: I need an idea for a vbModal form trick please.
    ... >> I can use SetWindowPos to make it the top most form but I can't load the ... >> I have thought of building a separate application just for the search ... >> facility and then shelling it but then the user may end up loading more ... > ActiveX EXE. ...
    (microsoft.public.vb.enterprise)