🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.internet.web
Article #248

TCPPWebBrowser SLOW for a certain time of day

#248
From: Eduardo Jauch
Date: Tue, 06 Feb 2007 16:47
229 lines
6221 bytes
Hi!

I make a program that works perfectly! (almost ;) LOL)

Any way, on certain times of day the pages are loaded VERY slowly.
The IE too are very slowly to LOAD the pages...

I think first about traffic on the site.

But I then used the Firefox, and no problem!!!
The same pages are download in about 2 seconds in firefox, while in IE 
can take to 2 minutes!!!!!!!!!

The IE 6 (is that I use), have to access some server in certain times or 
for some reason, like the MSN?

Was not my code I think, but anyway, I do this:

The code is this:



This is the code that Load the pages...

void TjanelaPrincipal::CarregarFrame(WideString url)
{
   TVariant FrameName( "iContent" );

   paginaCarregada = false;
   Browser->Navigate( url, TNoParam(), &FrameName );

   while( !paginaCarregada )
   {
     Application->ProcessMessages();
   }
}


paginaCarregada (this mean: pageLoaded) is changed this way:

void __fastcall TjanelaPrincipal::BrowserNavigateComplete2(TObject *Sender,
       LPDISPATCH pDisp, Variant *URL)
{
   if (!CurDispatch)
     CurDispatch = pDisp;
}
//---------------------------------------------------------------------------

void __fastcall TjanelaPrincipal::BrowserDocumentComplete(TObject *Sender,
       LPDISPATCH pDisp, Variant *URL)
{

   if (pDisp == CurDispatch)
   {
     CurDispatch = NULL;

     FrameDoc = Frame( WideString("iContent") );

     if( FrameDoc )
       FrameDoc->get_all( &All );
     else
     {
       ShowMessage("ERRO!!! \'Frame\' n�o encontrado!");
       return;
     }

     if( !All )
     {
       FrameDoc->Release();
       ShowMessage("ERRO!!! \'All\' n�o encontrado!");
       return;
     }

     paginaCarregada = true;
   }
   else
   {
     paginaCarregada = false;
   }
}


Any better ideas to do this?
I cannot put my code direct in BrowserDocumentComplete, for various 
reasons....

One is that I use this code:

int TjanelaPrincipal::Agendamento(void)
{
   IDispatch *pDisp;
   IHTMLInputElement *pInput;
   IHTMLSelectElement *pSelect;
   IHTMLOptionElement *pOption;
   TAGIntervalo *pIntervalo;
   WideString opcao;
   AnsiString qtde;
   long pItens;
   int i, m, d, h, qtde_n;

   meses.Reiniciar();
   datas.Reiniciar();

   pSelect = SelectElement("mesDisponivel");
   pSelect->get_length( &pItens );

   for( i = 1; i < pItens; i++ )
   {
     pOption = OptionElement( pSelect, i );

     if( !pOption ) return -1;

     pOption->get_text( &opcao );
     pOption->Release();

     meses.AdicionarData( opcao );
     info_mm->Lines->Add( "M�S: " + AnsiString(opcao) );
   }
   pSelect->Release();

   int prxMes;
   int prxData;
   for( m = 0; m < meses.MesesAptos; m++ )
   {
     pSelect = SelectElement( "mesDisponivel" );
     if( !pSelect ) return -1;

     prxMes = meses.IndiceProximaData;
     if( prxMes == -1 ) return 0;

     pSelect->put_selectedIndex( prxMes );
     pSelect->Release();

     datas.Reiniciar();
     CarregarFrame( "javascript: popularListaDiasDisponiveis()" );


     //Carrega os dias para o M�S selecionado
     pSelect = SelectElement( "diaDisponivel" );
     if( !pSelect ) return -1;

     pSelect->get_length(&pItens);

     for(i = 1; i < pItens; i++)
     {
       pOption = OptionElement( pSelect, i );

       if( !pOption ) return -1;

       pOption->get_text( &opcao );
       pOption->Release();

       datas.AdicionarData( opcao ); //save the date
       info_mm->Lines->Add( "  Data: " + AnsiString(opcao) );
     }
     pSelect->Release();

     //Vasculha os dias para encontrar um apto
     for( d = 0; d < datas.DatasAptas; d++)
     {
       pSelect = SelectElement( "diaDisponivel" );
       if( !pSelect ) return -1;

       prxData = datas.IndiceProximaData;
       if( prxData == -1 ) break;

       pSelect->put_selectedIndex( prxData ); //Get next date if there 
are some interesting.

       pSelect->Release();

       CarregarFrame( "javascript: popularListaHorariosDisponiveis()" );


       pSelect = SelectElement( "seqHorarioAgendamentoDisponivel" );
       if( !pSelect ) return false;

       pSelect->get_length( &pItens );

       for( i = 1; i < pItens; i++ )
       {
         pOption = OptionElement( pSelect, i );
         if( !pOption ) break;

         pOption->get_text(&opcao);
         pOption->Release();

         //info_mm->Lines->Add( datas.DataStr[prxData] + ":" + 
AnsiString(opcao) );

         if(opcao.Length() == 38)
           qtde = opcao.SubString(28, 2);
         else
           qtde = opcao.SubString(28, 1);

         qtde_n = qtde.ToInt();

         if(qtde_n >= requerentes->Count)
         {
           pSelect->put_selectedIndex(i);

           CarregarFrame( "javascript: confirmarAgendamento()" );


           pSelect = SelectElement( "seqHorarioAgendamentoDisponivel" );
           if( pSelect )
           {
             i = 1;
           }
           else
           {
             return 1; //Conseguiu AGENDAR
           }
         }
       }
       pSelect->Release();
     }
   }

   return 0; //Acabou a lista

}

Theres some component like TCppWebBrowser, but that uses firefox or 
other browser?

Any ideas???

Thanks! :)
Technical Details
Message-ID: <45c8ad84@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Thread: feeec,19ca628026a7cd6e,start
X-Google-Attributes: gidfeeec,public
X-Google-Language: ENGLISH,ASCII
Date: Tue, 06 Feb 2007 14:47:04 -0200
From: Eduardo Jauch <eduardo.jauch@gmail.com>
User-Agent: Thunderbird 1.5.0.9 (Windows/20061207)
MIME-Version: 1.0
Newsgroups: borland.public.cppbuilder.internet.web
Subject: TCPPWebBrowser SLOW for a certain time of day
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 8bit
NNTP-Posting-Host: 200.193.163.60
Message-ID: <45c8ad84@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1170779524 200.193.163.60 (6 Feb 2007 08:32:04 -0800)
Lines: 229
Path: arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail