Article View: borland.public.cppbuilder.nativeapi
Article #135Re: VCL Form inside TThread->Execute
From: James
Date: Sat, 14 Jun 2008 17:45
Date: Sat, 14 Jun 2008 17:45
60 lines
3130 bytes
3130 bytes
I would, except that the application that uses this thread form in not a C++
Builder application. In fact, it does not have its own support for
multi-thread, however it does allow dll calls.
Hence, I decided to wrap up a form object into a thread and place that into
a dll. Then they can create an instance and the form runs. The reason I
need this is because in their main application they may be executing a
lengthy database query. I wanted to provide a progress bar that shows that
the application has not hung, but is retrieving data. They also want to use
this when they download files, to indicate things are going well.
Thanks,
James
"Ed Mulroy [TeamB]" <dont_email_me@bitbuc.ket> wrote in message
news:4853e7cb$1@newsgroups.borland.com...
> For reliability and best performance VCL visuals are best handled in a
> single thread as the VCL does not contain elements to by default handle
> intra-thread issues. My opinion is that you should post something to the
> main thread for that form.
>
> To get others' opinions post to a group which better relates to the
> subject of your message. This group might be a good one to post in:
> borland.public.cppbuilder.vcl.components.using
>
> . Ed
>
>> James L. Williams wrote in message
>> news:4853e32c$1@newsgroups.borland.com...
>>
>> I would like to create a form that exists inside a Thread. I want this
>> so that the forms graphics updates are handled inside of a thread.
>>
>> I do something like the following:
>>
>> Thread::Execute()
>> {
>> MSG msg;
>> TmyForm * myForm = new TmyForm(NULL);
>> myForm->Parent = NULL;
>> myForm->ParentWindow = GetDesktopWindow();
>> myForm->Left = 10;
>> myForm->Top = 10;
>> myForm->Width = 500;
>> myForm->Height = 500;
>> myForm->Visible = true;
>> while(GetMessage(msg,NULL,0,0))
>> {
>>
>> if(Terminated) break;
>> TranslateMessage(&msg);
>> DispatchMessage(&msg);
>> }
>> delete myForm;
>> }
>>
>> Is this a good way to do it, or is there a better way?
>
>
Technical Details
Message-ID:
<485403a7@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!proxad.net!feeder1-2.proxad.net!194.25.134.126.MISMATCH!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<4853e32c$1@newsgroups.borland.com> <4853e7cb$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,de2c8c187b28c177 X-Google-Attributes: gid10cc67,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit From: "James" <Jim_L_Williams@hotmail.com> Newsgroups: borland.public.cppbuilder.nativeapi References: <4853e32c$1@newsgroups.borland.com> <4853e7cb$1@newsgroups.borland.com> Subject: Re: VCL Form inside TThread->Execute Date: Sat, 14 Jun 2008 12:45:02 -0500 Lines: 62 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.3138 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3198 X-RFC2646: Format=Flowed; Response NNTP-Posting-Host: 204.194.63.129 Message-ID: <485403a7@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1213465511 204.194.63.129 (14 Jun 2008 10:45:11 -0700) Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!proxad.net!feeder1-2.proxad.net!194.25.134.126.MISMATCH!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail