🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #133

VCL Form inside TThread->Execute

#133
From: James L. Williams
Date: Sat, 14 Jun 2008 15:17
36 lines
1800 bytes
Hello,

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?

Thanks,


James 
Technical Details
Message-ID: <4853e32c$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news4.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

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,de2c8c187b28c177,start
X-Google-Attributes: gid10cc67,domainid0,public,usenet
X-Google-Language: ENGLISH,ASCII-7-bit
From: "James L. Williams" <Jim_L_Williams@hotmail.com>
Newsgroups: borland.public.cppbuilder.nativeapi
Subject: VCL Form inside TThread->Execute
Date: Sat, 14 Jun 2008 10:17:37 -0500
Lines: 37
MIME-Version: 1.0
Content-Type: text/plain;
 format=flowed;
 charset="iso-8859-1";
 reply-type=original
Content-Transfer-Encoding: 7bit
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Windows Mail 6.0.6001.18000
X-MimeOLE: Produced By Microsoft MimeOLE V6.0.6001.18000
NNTP-Posting-Host: 69.44.29.66
Message-ID: <4853e32c$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1213457196 69.44.29.66 (14 Jun 2008 08:26:36 -0700)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news4.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