Diese Seite mit anderen teilen ...

Informationen zum Thema:
WinDev Forum
Beiträge im Thema:
Erster Beitrag:
vor 3 Jahren, 3 Monaten
Letzter Beitrag:
vor 3 Jahren, 3 Monaten
Beteiligte Autoren:
KOZETA, Joris, Alexandre Leclerc, Bart VDE


Startbeitrag von KOZETA am 16.03.2015 15:04

Hello everyone,
How can I execute threads on the background?
(the threads include file downloading)
Best regards,
Kozeta Leka



1. write your procedure to download the files etc...
2. run this procedure using the ThreadExecute command


This should do it.

von Joris - am 16.03.2015 15:30
I have actually tried it, but no files are downloaded.

von KOZETA - am 16.03.2015 15:51

And you are using code like this?


maybe you should insert some trace commands in your procedure to check where it goes wrong.


von Joris - am 17.03.2015 12:32
Yes, this is the way I am using it...and when I am debugging it line by line , it actually works. I use this code in the "onclick" event of a button. Maybe there is something wrong with that? I don't know.... I have never used threads before.

von KOZETA - am 18.03.2015 09:04

Keep in mind : don't use functions like info(...) or error(...) in your procedure.
Maybe that's the case ?


von Bart VDE - am 18.03.2015 09:21
I do use info() but the procedure never goes that way....because info is used if there's an error during the connection to a web service.
I also use ignoreError and it is mandatory since I am using a web service that would not work other way...

von KOZETA - am 18.03.2015 09:30
Hi Kozeta,

Be very diligent when working with thread, especially when you have no experience. Please, listen carefully to what has been posted up to now.

Here is a list of thing you can check:

1. Is your procedure working normally outside a thread?
2. Is your procedure making any interractions with the user interface? (Like Info() Message boxes, windows)? If yes, please absolutely remove that totally and use a different error reporting mechanism outside of the procedure.
3. Is your newly corrected procedure working outside the thread?
4. Make the thread very simply at first. Make the procedure an automatic procedure: http://doc.windev.com/en-US/?9000072&name=Automatic_procedures#NOTE2_3
5. Does this work?
6. Then remove this automatic procedure option. Call your procedure with ThreadExecute().
7. If this is not working, check if you are using many times the same thread at the same time. This is not possible in automatic thread management. You must use Critical sections and manage threads manually with critical sections. You do this with ThreadMode(): http://doc.windev.com/en-US/?3077028

I hope this will help you. There was two lengthy threads in this forums couple months ago about the very same topic. Maybe this can be of help to you.

Best regards,
Alexandre Leclerc

von Alexandre Leclerc - am 18.03.2015 12:41
Thank you very much Alexandre!
I will check and see if it helps in my case.
Thanks agai! :)
Best regards,
Kozeta Leka

von KOZETA - am 18.03.2015 12:51
Zur Information:
MySnip.de hat keinen Einfluss auf die Inhalte der Beiträge. Bitte kontaktieren Sie den Administrator des Forums bei Problemen oder Löschforderungen über die Kontaktseite.
Falls die Kontaktaufnahme mit dem Administrator des Forums fehlschlägt, kontaktieren Sie uns bitte über die in unserem Impressum angegebenen Daten.