1 (edited by mathmathou 2015-11-24 06:39:38)

Topic: [Solved] - Execution threads

Hello Dmitry and all MVD fans,


With "small" applications and "fast" computation times, there is no difference for the end user because he gets the result pretty fast.


But I'm experiencing someting "odd" :


I have a procedure that is almost 600 lines long and which involves more than a hundred variables...

The process involves getting the source code of a web page, shuffling through it for scraping info, saving images to disk and so on.

On some pages, the computation time can be as long as 10 seconds.


During this time the GUI (the Form the user has in front of him) is completely frozen. Windows sometimes even reports it as "non responding" and propose to close it.


Of course, if you wait, you finally get you results and everything works fine (I'm handling exceptions all over the code).


Is there a way around this ? I read about threads and running processes in their own thread with TThread.Execute but I'm not sure what to do with this and even if MVD supports it.


Dmitry ? Did you already had long computation times on applications, and do you know how to make it though the application is not frozen during all the process ?


Have a good day all


Cheers


Mathias

I'm a very good housekeeper !
Each time I get a divorce, I keep the house

Zaza Gabor

Re: [Solved] - Execution threads

try to insert in body cycle (for to do) this line:

Application.ProcessMessages; 
Dmitry.

Re: [Solved] - Execution threads

Hello Dmitry,


Thank you for your fast answer !

Do you mean inserting

Application.ProcessMessages; 

just after the "Begin" clause of the long procedure ?

Or somewhere else in the code ?

I'm a very good housekeeper !
Each time I get a divorce, I keep the house

Zaza Gabor

Re: [Solved] - Execution threads

Please let me see your code.

Dmitry.

Re: [Solved] - Execution threads

Hey Dmitry,

I missed you answer, sorry.

I got out of this by putting the Application.ProcessMessages;  AFTER each instruction I wanted executed while the general script I'm running is computing.

That does the trick for now.

But you'll see my code, don't worry. I think I'm reaching my limits on that project smile

Cheers

Math

I'm a very good housekeeper !
Each time I get a divorce, I keep the house

Zaza Gabor