ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Threads ... possible in VBA (https://www.excelbanter.com/excel-programming/345459-threads-possible-vba.html)

SkylineGTR

Threads ... possible in VBA
 
Hi all,

I would like to be able to have a separate thread running while I
execute an API call - specifically, "URLDownloadFile". I want to be
able to implement a callback function such that as a file is being
downloaded I can give users feedback on progress. The API is
synchronous, therefore VBA blocks until the operation is complete ...
this is not what I want.

Has anyone come across similar problems, and if so how how did you
overcome it?

This group has not let me down so far ... I need your brains!!

Cheers


Leith Ross[_268_]

Threads ... possible in VBA
 

Hello SkylineGTR,

Here is a link to discussion I think will help you out. It discusses
using an API timer to switch between the download operation and the VB
code. The VBA AddressOf operator makes using API callbacks easy. This
may not be the ideal solution, but sometimes close enough will do.
Here's the link http://www.vb-forum.com/showthread.php?t=226495

Sincerely,
Leith Ross


--
Leith Ross
------------------------------------------------------------------------
Leith Ross's Profile: http://www.excelforum.com/member.php...o&userid=18465
View this thread: http://www.excelforum.com/showthread...hreadid=484599


SkylineGTR

Threads ... possible in VBA
 
Hi Ross,

Many thanks for your reply. I tried using WinAPI timers, and all
seemed well until I called I "URLDownloadFile" API. The timer stopped
until URLDownloadFile had finished, then carried on again ... hmm ...
any ideas?


Leith Ross[_278_]

Threads ... possible in VBA
 

Hello SkylineGTR,

I would need to see your code. With API calls and callbacks it can be
dangerous to hazard a guess. Post if you can, if not my email is
.

Sincerely,
Leith Ross


--
Leith Ross
------------------------------------------------------------------------
Leith Ross's Profile:
http://www.excelforum.com/member.php...o&userid=18465
View this thread: http://www.excelforum.com/showthread...hreadid=484599



All times are GMT +1. The time now is 01:43 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com