🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Thread

#14089
From: saravanan
Date: Tue, 26 Aug 2003 16:39
56 lines
3085 bytes
Hi

I am using 3rd party OCX control in my Application. Since the response time is too poor for that control, my application looks sluggish.  So i tried to create the control in seperate thread and post the request to that thread.  That works fine. But have some problem with that...

Code before threading model is implemented :

XControl = new TXControl( NULL ) ;                                                          //..Creating the 3rd party control
XControl->BackgroundColor = mBackground ;                                            //..Changing the color
XControl->ForegroundColor = mForeground ;
...
XControl->ProcessMessage () ;

Code after threading modal :

    I have moved all the processing operations to seperate thread and customization options in primay thread...

TServiceThread *lServiceThread = new TServiceThread ( false) ;                    //..Creating a thread and creating the 3rd party control
XControl = lServiceThread->GetControl () ;                                                    //..Get the pointer for the created control

XControl->BackgroundColor = mBackground ;                                                //..Customizing the color in primary thread
XControl->ForegroundColor = mForeground ;

PostMessage ( lServiceThread->ID, PROCESS, 0, 0 ) ;

class TServiceThread : public TThread {

    Execute () {
     XControl = new TXControl (NULL) ;

    while( (!Terminated) && (GetMessage(&msg, NULL, 0, 0) > 0))
    {
      switch(msg.message)  {
        case PROCESS : {
            XControl->ProcessMessage () ;
        }
    }

    TranslateMessage(&msg);
    DispatchMessage(&msg);
   }

  TXControl *GetControl () {
    return XControl ;
  }
} ;


My problem is how can i ensure that XControl has been created before executing the below mentioned line :
    XControl = lServiceThread->GetControl () ;                                                    //..Get the pointer for the created control
    XControl->BackgroundColor = mBackground ;                                                //..Customizing the color in primary thread
    XControl->ForegroundColor = mForeground ;

Thanks in advance

Saravanan A
Technical Details
Message-ID: <3f4b8d2f$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-03!sn-xit-04!sn-xit-01!sn-xit-09!supernews.com!news.maxwell.syr.edu!nntp.infostrada.it!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10cc67,d3c99904b7c174bd,start
X-Google-Attributes: gid10cc67,public
X-Google-ArrivalTime: 2003-08-26 09:40:16 PST
From: "saravanan" <Saravanan@opussoft.com>
Sender: "saravanan" <Saravanan@opussoft.com>
Reply-To: "saravanan" <Saravanan@opussoft.com>
Subject: Thread
Newsgroups: borland.public.cppbuilder.nativeapi
X-User-Info: 203.199.207.172 203.199.207.172    
NNTP-Posting-Host: 207.105.83.65
Message-ID: <3f4b8d2f$1@newsgroups.borland.com>
Date: 26 Aug 2003 09:39:11 -0700
X-Trace: newsgroups.borland.com 1061915951 207.105.83.65 (26 Aug 2003 09:39:11 -0700)
Lines: 57
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-03!sn-xit-04!sn-xit-01!sn-xit-09!supernews.com!news.maxwell.syr.edu!nntp.infostrada.it!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail