Stef Merlijn
asked on
Break processing of procedure
Hi,
In very rare cases processing of a button-onclick (send E-mail) procedure freezes on a customer's PC. Till now I haven't been able to trace the cause of this behaviour, but it is of the essence that my application doesn't have to be shutdown (the hard way) in order to preserve some data.
Therefore I want to add an option for the user to KILL the process, without the need to end program execution.
Can anybody advice me on how to accomplish this?
In very rare cases processing of a button-onclick (send E-mail) procedure freezes on a customer's PC. Till now I haven't been able to trace the cause of this behaviour, but it is of the essence that my application doesn't have to be shutdown (the hard way) in order to preserve some data.
Therefore I want to add an option for the user to KILL the process, without the need to end program execution.
Can anybody advice me on how to accomplish this?
Have you tried putting a try/except wrapper in your Button OnClick event handler?
ASKER
Yes, but there is no error. It freezes at some point in the process.
You say it is sending an Email. How are you doing that? MAPI?
ASKER
I'm using components from Clever Components Suite. Sending is done directly via SMTP.
Have you contact Clever Components developers? They might help you. They know things under the hood ....
ASKER
Yes, we did some logging, but nothing out of the ordinairy.
That's why I ask my question. I ran out of options for now.
That's why I ask my question. I ran out of options for now.
I don't know Clever Comp.
Freezing does not necessarily equal crash. Perhaps the component is somehow getting into an endless loop.
If you can't fix the freeze... let me suggest a different approach: Maybe you could create a fail-safe file that contains critical recovery data before starting your Email process. If the process succeeds (doesn't freeze) you delete the file. If the file exist upon restart then you know the program had to be crashed, therefore you know that you need to apply the recovery data before continuing. I know it's kind of an ugly work-around, of course the best solution is to not freeze in the first place.
Freezing does not necessarily equal crash. Perhaps the component is somehow getting into an endless loop.
If you can't fix the freeze... let me suggest a different approach: Maybe you could create a fail-safe file that contains critical recovery data before starting your Email process. If the process succeeds (doesn't freeze) you delete the file. If the file exist upon restart then you know the program had to be crashed, therefore you know that you need to apply the recovery data before continuing. I know it's kind of an ugly work-around, of course the best solution is to not freeze in the first place.
ASKER
The only way I could recover as suggested, I would need to copy DB-records just before mailing. But in a multi user environment it's not very reliable/useful.
I prefer to terminate the mailing somehow.
I prefer to terminate the mailing somehow.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
... or you can use Indy components....
ASKER
Thank you!
ASKER
A very useful article I found for setting up a thread:
https://www.experts-exchange.com/articles/239/Displaying-progress-in-the-main-form-from-a-thread-in-Delphi.html
https://www.experts-exchange.com/articles/239/Displaying-progress-in-the-main-form-from-a-thread-in-Delphi.html