Welcome to threading-hell.
 
I went through this - I suspect most of us have gone through this at one time 
or another as we started to play with threading.
 
The only thing I can suggest, as did another writer, is not to have any thread 
code in the OnCreate event of a form.
 
I would always specifically create my threads completely and then send/deploy 
them as the very last step.
 
Also make sure they are synchronized properly - especially if they have to 
report data back to the main app thread.
 
One other thing that might help you is to look at the threading example that 
comes with D7 Enterprise.  That helped me get started.
 
Good luck!
 
- Sean
 
"Save the whales, save the rainforests, but FREE the threads!"XFX nForce 680i 
LT SLI Socket 775 | Intel Core 2 Duo E6750 OC:1600 FSB @ 3.2 MHz | 2 x OCZ SLI 
1024MB PC6400 DDR2 800MHz| XION 600w PSU | CM Stacker 200 ATX/BTX Case | EVGA 
GeForce 8800 GTS 512 | WD SATA 74 GB Raptor (boot/system), WD SATA 500 GB 
(storage) | Windows XP Pro, SP3 | Patient and supportive significant other


To: [EMAIL PROTECTED]: [EMAIL PROTECTED]: Fri, 20 Jun 2008 08:46:00 
+0000Subject: Re: [advanced_delphi] TThread Error




Dear Eddy,Its worse than I thought!!!I tried your suggestion - no good. I then 
installed Microsofts Virtual PC (6.0.192.0), setup Win98SE & Delphi 7 (Build 
8.1). I made a copy of the Project in a seperate folder on our development 
server and tried to open the project. I am now getting the Thread Error message 
as the project loads. The main forms' code module is displayed but the actual 
form is not available!I think the answer may be to roll the copy back to before 
I added the thread code and then re-apply the new code in the Win98 VM 
environment until it breaks - unless anybody has any quicker suggestions.Paul.> 
----- Original Message -----> From: "Eddy Wijaya" <[EMAIL PROTECTED]>> To: 
advanced_delphi@yahoogroups.com> Subject: Re: [advanced_delphi] TThread Error> 
Date: Fri, 20 Jun 2008 09:05:44 +0700> > > Dear Paul,> > Have you tried to 
moved your declaration of thread to> AfterConstruction of the form ?> because 
creating a Thread on construction form is some times could> caused you a pain 
why ? because it is possible that the thread accessing> variable that> possible 
not created yet.so it is better safe to create the thread on> AfterConstruction 
Procedure or.. u can create a trigger from the form> ex: when showing the form 
then create the thread.> > regards,> Eddy Wijaya> > > VCL,Tips,Snippet All 
Delphi And Codegear Related Could Be Found here> http://www.alldelphi.com> > 
Paul Bennett wrote:> >> > Hi All,> > Can anyone help with this one?> >> > I 
have an application written using D7 Ent. which runs fine on XP and> > 98SE. 
Currently the application loads its data from a CD, but the> > powers that be 
have decided that they would like to network the> > application and download 
the data periodically across the LAN.> >> > In order to achieve this I have 
created a small helper class> > (TAutoDownload) which is owned and created by 
the main form. This> > helper class is created during the Form Creation 
procedure and freed> > by the Form Destructor.> >> > TAutoDownload contains 2 
TThread objects, 1) a Timer Thread, and 2)> > the thread that handles the 
actual download of the Data Files. Both> > threads are created as and when 
required by the Class.> >> > The new application works fine when running on XP, 
but as soon as I> > try to run it under 98' it crashes with the following 
error:> >> > Error Creating Form: Thread Error: The Parameter is incorrect 
(87).> >> > As far as I can tell this error occurs during the Main Forms 
Creation> > (but before any of the FormCreate code executes - ie the code 
never> > gets as far as a breakpoint on the first line of the FormCreate> > 
procedure).> >> > I've done a Google on TThread Errors, Delphi 7 and Win98, but 
the only> > hit that seems to be relevant refers to bug in the TThreads 
destructor> > method. I have implemented the suggested change, but it has had 
no effect.> >> > Any ideas would be very welcome.> >> > TIA> >> > Paul.> >> >> 
> ----------------------------------------------------------> >> >> > No virus 
found in this incoming message.> > Checked by AVG. Version: 8.0.100 / Virus 
Database: 270.4.0/1508 - > > Release Date: 6/18/2008 9:08 PM> >>Experience is 
something you don't get until just after you need it. -- 
_______________________________________________Surf the Web in a faster, safer 
and easier way:Download Opera 9 at http://www.opera.comPowered by Outblaze 






_________________________________________________________________
Earn cashback on your purchases with Live Search - the search that pays you 
back!
http://search.live.com/cashback/?&pkw=form=MIJAAF/publ=HMTGL/crea=earncashback

Reply via email to