 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Daryl Guest
|
Posted: Sat Dec 13, 2003 8:18 pm Post subject: How to use a TThread component... |
|
|
I am interested in using TThread to parse a text file and populate a
database table, is there anyone that can give me a few pointers as to how
this could be done? Also if there are any traps to watch out for?
Also, is it a good idea to handle exceptions within the thread?
Daryl
|
|
| Back to top |
|
 |
nicolasr Guest
|
Posted: Tue Dec 16, 2003 11:55 am Post subject: Re: How to use a TThread component... |
|
|
Hi,
just a few points:
Create a descendant of TThread, override the Execute() method.
In Execute() populate the database. Make sure that you check
the threads Terminated variable regularly such that the thread can
be stopped from outside if needed. If Terminated==true close all
open resources (files, database etc.) and leave Execute().
You probably want to show some progress status. Don't show a form
inside the thread! Instead create a form in the main thread and define
f.e. custom messages that the thread can post to the main thread via
PostMessage() such that the main thread will display the status form.
Catch exceptions inside your threads Execute().
hope this helps,
Nick
"Daryl" <stockd (AT) tpg (DOT) com.au> schrieb im Newsbeitrag
news:3fdb74db (AT) newsgroups (DOT) borland.com...
| Quote: | I am interested in using TThread to parse a text file and populate a
database table, is there anyone that can give me a few pointers as to how
this could be done? Also if there are any traps to watch out for?
Also, is it a good idea to handle exceptions within the thread?
Daryl
|
|
|
| Back to top |
|
 |
Rodolfo Frino - Macrosoft Guest
|
Posted: Fri Dec 19, 2003 2:51 pm Post subject: Re: How to use a TThread component... |
|
|
Why not doing that directly with the win32 API's?
"Operating System: Bunch of software that makes your life easier by making
your system more difficult to understand". Rodolfo, 2003
"Daryl" <stockd (AT) tpg (DOT) com.au> wrote
| Quote: | I am interested in using TThread to parse a text file and populate a
database table, is there anyone that can give me a few pointers as to how
this could be done? Also if there are any traps to watch out for?
Also, is it a good idea to handle exceptions within the thread?
Daryl
|
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|