Our members are dedicated to PASSION and PURPOSE without drama!

VB.net - Leaking memory in webbrowser

Started by Stepkevh, November 26, 2012, 10:46:16 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Ophis

Quote from: Stepkevh on November 28, 2012, 12:03:25 PM
and if i close the table it doesn't give all the memory back

:cheer:  welcome in my world.

Quote from: Ralph on November 28, 2012, 01:05:31 PM
Margins can differ and can affect coordinates.
If you will get handle of a child of a child of child of a child... window in the browser you will get just the area where flash plugin is running.
coordinates will work in all browsers...

:applause:
Multi Systems Tracker
➨ *Link Removed*

Stepkevh

The build in WB is IE so that's not a problem

Ophis,

It will give the memory back if i use a stop button.
But if i use the "exit" button from the table itself then i only get 1/3 of my memory back  ???

And i use the same code
Skype :    stepke_vh@hotmail.com

Ralph

Steff1


I faced this problem as well. I took a picture of the screen and used a label which cover the button of the casino, then I coded an event for the click which handel the thing. Still it can be problem if the user open a new window clicking a link  on a casino pages, and the forcing to stay is on. The script on the casino page can not know what's happen. So I do not let them for example deposit using the bot, it shall be in the ordinary webbrowser. It is a security matter as well.

Ophis

Which Stop Button? In your bot?... What does Stop button do? Does it free some resources?

Maybe use onCloseQuery in WebBrowser.... this will be called whenever you use Exit button on BV table

Code (delphi) Select

//separate form just for casino table created on NewWindow2 event

procedure TTableForm.wbCloseQuery(Sender: TObject; var CanClose: Boolean);
begin
  CanClose:=False;
 
  //do some stuff that your STOP is doing or call smth like botSTOP:=True and put conditions in bot function to stop whenever it happen

  wb.Navigate('about:blank');
  Self.Free;
end;
Multi Systems Tracker
➨ *Link Removed*

Ophis

...or you can make one function:

CloseCasinoTable

which will be called when pressing Stop Button AND closeQuery;

Code (delphi) Select

procedure TTableForm.wbCloseQuery(Sender: TObject; var CanClose: Boolean);
begin
  CanClose:=False;
  CloseCasinoTable;
end;


...so the same thing will happen whenever someone press STOP or just close the table with X
Multi Systems Tracker
➨ *Link Removed*

Stepkevh

My browsers run in a tabcontrol.
So the code that i use for the "stop" button is
 
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click

' Stop Button
If TabControl1.TabCount > 1 Then
TabControl1.SelectedTab.Dispose()
End If 
newtab.AxWebBrowser1.Navigate("about:blank")
End Sub


This code releases the resource from the browser that contained the table

But if i click the "exit" on the casinotable itselfthen there is a FormClose triggered.
So i use the same code for the FormClosing event except that i add  e.cancel = true

but this doesn't release all the resources
Skype :    stepke_vh@hotmail.com

Ophis

before you call
TabControl1.SelectedTab.Dispose()
try calling
AxWebBrowser1.Navigate("about:blank")

this is IE...
in some cases it helps to navigate to blank to clear cached element before releasing memory...
Multi Systems Tracker
➨ *Link Removed*

Stepkevh

found it, needed to use the code in the webbrowser.windowclosing event  :)
Skype :    stepke_vh@hotmail.com

Ophis

use separate function to close table and free memory

function Destroy_The_Damn_Table
and call it on StopButtonClick AND WebBrowserCloseQuery
Multi Systems Tracker
➨ *Link Removed*