 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Eduardo Jauch Guest
|
Posted: Sun Feb 04, 2007 8:47 pm Post subject: TCppWebBrowser use of memory (consuming it all) |
|
|
Hi
Me again ;)
I was able to create some code looking here, google groups and a link
that Remy posted here on the Interfaces (MUCH useful! Thanks Remy)...
The program works fine.
But the amount of memory "allocated" by the process always incrase...
Because I'm a newbe to programming with TCppWebBrowser, I can't find
where this memory is been allocated and not released.
Like you can see (if I'm wrong, please, teel me), I'm not allocating
memory myself.
Anyway,
To work out this memory usage problem, I create a simpler version of the
program. I show you the code below.
After click the "iniciar_bt" button, only these three functions are
executed:
BrowserNavigateComplete2
EncontrarFrame
BrowserDocumentComplete
I'm try to debug, while observing the use of memory (from task maneger)
I figured that when the program leaves the function
BrowserDocumentComplete, the memory that was "catch" when enter, is not
all freed then..
Any ideas of what I'm doing wrong?
//---------------------------------------------------------------------------
void __fastcall TjanelaPrincipal::iniciar_btClick(TObject *Sender)
{
Browser->Navigate(WideString("www.visto-eua.com.br"));
}
//---------------------------------------------------------------------------
IHTMLDocument2 *TjanelaPrincipal::EncontrarFrame(WideString frame_name)
{
IHTMLDocument2 *FrameDoc;
FrameDoc = NULL;
if( Browser->Document )
{
IHTMLDocument2 *Doc = NULL;
Browser->Document->QueryInterface(IID_IHTMLDocument2,(LPVOID*)&Doc);
if( Doc )
{
IHTMLFramesCollection2 *Frames;
Doc->get_frames(&Frames);
Doc->Release();
if( Frames )
{
TVariant IndexOrName = frame_name;
TVariant Frame;
Frames->item(&IndexOrName, &Frame);
Frames->Release();
if( (V_VT(&Frame) == VT_DISPATCH) && (V_DISPATCH(&Frame) != NULL) )
{
IHTMLWindow2 *Window;
V_DISPATCH(&Frame)->QueryInterface(IID_IHTMLWindow2,(LPVOID*)&Window);
if( Window )
Window->get_document(&FrameDoc);
Window->Release();
}
}
}
}
return FrameDoc;
}
//---------------------------------------------------------------------------
void __fastcall TjanelaPrincipal::BrowserNavigateComplete2(TObject *Sender,
LPDISPATCH pDisp, Variant *URL)
{
if (!CurDispatch)
CurDispatch = pDisp; // save for comparison
}
//---------------------------------------------------------------------------
void __fastcall TjanelaPrincipal::BrowserDocumentComplete(TObject *Sender,
LPDISPATCH pDisp, Variant *URL)
{
IHTMLDocument2 *FrameDoc;
TVariant FrameName("iContent");
IHTMLElementCollection *All;
IDispatch *Disp;
IHTMLInputElement *pInput;
if (pDisp == CurDispatch)
{
CurDispatch = NULL;
FrameDoc = EncontrarFrame(WideString("iContent"));
if( FrameDoc )
FrameDoc->get_all(&All);
else
return;
if(!All)
{
FrameDoc->Release();
return;
}
if(pagina == 1)
{
pagina = 2;
FrameDoc->Release();
All->Release();
Browser->Navigate(WideString("http://www.visto-eua.com.br/agendamento-web/login?redirect=/agenciadores.do"),
NULL, &FrameName);
}
else if(pagina == 2)
{
All->item(TVariant(WideString("login")), TVariant(0), &Disp);
if( !Disp ) return;
Disp->QueryInterface(IID_IHTMLInputElement, (LPVOID*)&pInput);
Disp->Release();
if( !pInput ) return;
pInput->put_value(WideString ("MyLogin"));
pInput->Release();
All->item(TVariant(WideString("senha")), TVariant(0), &Disp);
if( !Disp ) return;
Disp->QueryInterface(IID_IHTMLInputElement, (LPVOID*)&pInput);
Disp->Release();
if( !pInput ) return;
pInput->put_value(WideString("MyPassword"));
pInput->Release();
pagina = 1;
FrameDoc->Release();
All->Release();
Browser->GoBack();
}
}
} |
|
| Back to top |
|
 |
Eduardo Jauch Guest
|
Posted: Sun Feb 04, 2007 10:37 pm Post subject: Re: TCppWebBrowser use of memory (consuming it all) |
|
|
I'm starting to believe that there a problem with the IE...
Rhe same behaviour I have when use the IE. Every page increase the
amount of memory to the process...
I disabled images and everithing that seens to use memory, but don't work...
Anyone knows why this occour? The IE have some type of bug?
Thanks!  |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|