Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

API Holdup

12 views
Skip to first unread message

Aoli

unread,
Mar 1, 2022, 1:29:26 PM3/1/22
to
Is there a way to "DoEvents" when an API is called and VB6 has to wait
for the API to return ?

I usually use a timer to launch some things withing VB.

e.g.
When I Drag-Drop onto my app, I only store information in a collection
(as an example) and then when finished I trigger a timer to jump to
processing the collection data in another method. This disconnects the
drag-drop from say Explore and releases Explorer.

But with other things, like Ping, I am not sure how to know if Ping has
returned. Probably a poor example.

I have been using multiple of the same ActiveX.EXE to do processes that
their API hangs op stuff so my main app can continue. The he
ActiveX.EXE raises an event back to the main app for processing.

How do others do it ?

ObiWan

unread,
Mar 7, 2022, 10:03:47 AM3/7/22
to
:: 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





0 new messages