by CarlitoGil » Tue Jan 12, 2010 6:43 am
MM 3.2.0.1294, Windows 7 x64, IE8
This script demonstrates that
DestroyControl does indeed destroy the control but does not free all memory (watch Task Manager)
Searched and asked and this is supposed to be the way to destroy browsers.
How to completely destroy ActiveX Browser?
###### Scripts.ini ######
[TestLeak]
Filename=TestLeak.vbs
Procname=TestLeak
DisplayName=Test Leak
Order=100
ScriptType=0
Language=VBScript
Description=Testing
Shortcut=Shift+Q
###### TestLeak.vbs ######
Option Explicit
Sub TestLeak()
Dim Timer, Form, WB
Set Timer = SDB.CreateTimer(2000)
Script.RegisterEvent Timer, "OnTimer", "TestLeakTimer"
Set Form = SDB.Objects("TestLeakWindow")
Set WB = SDB.Objects("TestLeakWebBrowser")
If Not (WB Is Nothing) Then
WB.Common.DestroyControl
Set WB = Nothing
Set SDB.Objects("TestLeakWebBrowser") = Nothing
If (Form.Common.Visible) Then Exit Sub
End If
If Not (Form Is Nothing) Then
If Not (Form.Common.Visible) Then Script.UnregisterEvents Timer
Script.UnregisterEvents Form
Form.Common.Visible = False
Form.Common.ControlName = ""
Set Form = Nothing
Set SDB.Objects("TestLeakWindow") = Nothing
Exit Sub
End If
Set Form = SDB.UI.NewForm
Form.Common.SetRect 50, 50, 600, 400
Form.Common.MinWidth = 400
Form.Common.MinHeight = 300
Form.FormPosition = 4
Form.StayOnTop = False
Form.Caption = "Test Leak"
Form.Common.ControlName = "TestLeak"
Set WB = SDB.UI.NewActiveX(Form, "Shell.Explorer")
WB.Common.Align = 5
WB.Common.ControlName = "WB"
SDB.Objects("TestLeakWindow") = Form
SDB.Objects("TestLeakWebBrowser") = WB
WB.Interf.Navigate "google.com"
Form.Common.Visible = True
End Sub
Sub TestLeakTimer(Timer)
Script.UnregisterEvents Timer
Call TestLeak()
End Sub
MM 3.2.0.1294, Windows 7 x64, IE8
This script demonstrates that [b]DestroyControl[/b] does indeed destroy the control but does not free all memory (watch Task Manager)
Searched and asked and this is supposed to be the way to destroy browsers.
[i][b]How to completely destroy ActiveX Browser?[/b][/i]
[quote]
###### Scripts.ini ######
[TestLeak]
Filename=TestLeak.vbs
Procname=TestLeak
DisplayName=Test Leak
Order=100
ScriptType=0
Language=VBScript
Description=Testing
Shortcut=Shift+Q
###### TestLeak.vbs ######
Option Explicit
Sub TestLeak()
Dim Timer, Form, WB
Set Timer = SDB.CreateTimer(2000)
Script.RegisterEvent Timer, "OnTimer", "TestLeakTimer"
Set Form = SDB.Objects("TestLeakWindow")
Set WB = SDB.Objects("TestLeakWebBrowser")
If Not (WB Is Nothing) Then
WB.Common.DestroyControl
Set WB = Nothing
Set SDB.Objects("TestLeakWebBrowser") = Nothing
If (Form.Common.Visible) Then Exit Sub
End If
If Not (Form Is Nothing) Then
If Not (Form.Common.Visible) Then Script.UnregisterEvents Timer
Script.UnregisterEvents Form
Form.Common.Visible = False
Form.Common.ControlName = ""
Set Form = Nothing
Set SDB.Objects("TestLeakWindow") = Nothing
Exit Sub
End If
Set Form = SDB.UI.NewForm
Form.Common.SetRect 50, 50, 600, 400
Form.Common.MinWidth = 400
Form.Common.MinHeight = 300
Form.FormPosition = 4
Form.StayOnTop = False
Form.Caption = "Test Leak"
Form.Common.ControlName = "TestLeak"
Set WB = SDB.UI.NewActiveX(Form, "Shell.Explorer")
WB.Common.Align = 5
WB.Common.ControlName = "WB"
SDB.Objects("TestLeakWindow") = Form
SDB.Objects("TestLeakWebBrowser") = WB
WB.Interf.Navigate "google.com"
Form.Common.Visible = True
End Sub
Sub TestLeakTimer(Timer)
Script.UnregisterEvents Timer
Call TestLeak()
End Sub
[/quote]