:: On Tue, 1 Mar 2022 10:29:24 -0800
:: (microsoft.public.vb.general.discussion)
:: <svlom3$1vf1$
1...@gioia.aioe.org>
:: Aoli <Ao...@Aoli.com> wrote:
> Is there a way to "DoEvents" when an API is called and VB6 has to
> wait for the API to return ?
The answer is "it depends"; since it depends from the API(s), from the
architecture of the application and then some.
Some API(s) allow to specify a "callback" address, while others use an
event object (NOT VB Events !); but in any case, using those means
playing a bit of "black belt" programming, since otherwise the result
could be (and usually is) a crash; in other cases it's possible to use
separate ActiveX exe(s) to implement some kinda/sorta "multithreading"
(ok, multiprocessing), but even in such a case one should carefully
evaluate the overhead of such an approach. Another way could be using a
different language (e.g. "C") to build a DLL implementing the desired
call and serving them through multithreading, and then there's even
another way, that is, going as far as implementing multithreading
straigth in VB, but not only that isn't easy, but it's "threading on
thin ice" since you'll then have to be really careful; to sum it up,
there are a number of ways to perform async calls, but the one to use
depends from what you need for that given "piece of code"
The above being said, all this discussion, has been carried on quite a
number of times on this group, so my suggestion is to take some time
and read older threads about this very same argument