472,328 Members | 1,008 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,328 software developers and data experts.

Kill Internet Explorer axWebbrowser and restart

I have a aplication which hosts an axWebbrowser. This activex component needs about 10 to 15 mb of memory.

Because i have a option to move the aplication to tray icon and do some timer work i don't want that it just spends over 10mb for nothing.

So i remove the axwebbrowser with


which works fine. After show the application back from the tray icon i will
implement the axwebbrowser again with the same i did it before:

System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(frmMain));
this.axWebBrowser1 = new AxSHDocVw.AxWebBrowser();

// Tell the axwebbrowser that the main form controls the ie :)
object obj = axWebBrowser1.GetOcx();
IOleObject oc = obj as IOleObject;

// Some events we want to have
ie_events = (SHDocVw.WebBrowserClass) Marshal.CreateWrapperOfType(axWebBrowser1.GetOcx() , typeof(SHDocVw.WebBrowserClass));
SHDocVw.DWebBrowserEvents_BeforeNavigateEventHandl er BeforeNavigateE = new SHDocVw.DWebBrowserEvents_BeforeNavigateEventHandl er(OnBeforeNavigate);
ie_events.BeforeNavigate += BeforeNavigateE;

// The basic stuff to set the axwebbrowser into the form
((System.ComponentModel.ISupportInitialize)(this.a xWebBrowser1)).BeginInit();
this.axWebBrowser1.ContainingControl = this;
this.axWebBrowser1.Dock = System.Windows.Forms.DockStyle.Fill;
this.axWebBrowser1.Enabled = true;
this.axWebBrowser1.Location = new System.Drawing.Point(0, 0);
this.axWebBrowser1.OcxState = ((System.Windows.Forms.AxHost.State)(resources.Get Object("axWebBrowser1.OcxState")));
this.axWebBrowser1.Size = new System.Drawing.Size(100, 100);
this.axWebBrowser1.TabIndex = 0;
this.axWebBrowser1.NavigateComplete2 += new AxSHDocVw.DWebBrowserEvents2_NavigateComplete2Even tHandler(this.axWebBrowser1_NavigateComplete2);
((System.ComponentModel.ISupportInitialize)(this.a xWebBrowser1)).EndInit();
If i remove the oc.setclientsite(this) it works without any errors, but i can't control the ie on the full way
(the user content menu doesn't work) - but when i insert this line i get the error:

object not at object instance (translated from my german version :) )
At my app i use the iolecliensite, idochostuihandler, ioledocumentsite and idochostshowui methods.
at the idochostuihandler i implemented the context-menu routine:

public uint ShowContextMenu(uint dwID, ref tagPOINT ppt, object pcmdtReserved, object pdispReserved)
// use this code to show a custom menu
const int MenuHandled = 0;
Point p = new Point(ppt.x, ppt.y);
p = PointToClient(p);
ie_cmenu.Show(this, p);
return MenuHandled;

Or has anyone a idea how to free the memory from the axwebbrowser? But i want the component
back after showing the form again ;)


Nov 15 '05 #1
0 2774

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

by: Vilmar Brazão de Oliveira | last post by:
HI people, what is wrong in the code bellow to kill iexplore.exe process after processing my page?? '»»Before comes routines to access data base...
by: Joris VI | last post by:
I want to open internet explorer with a vb.net application Can anyone tells me what I need to d thanks
by: Nicolás Castagnet | last post by:
Hi, I write this post because I notice a strange behavior related with "Temporary Internet Files" and maybe some of you can help me to understand...
by: Graham | last post by:
Hi everyone I'm having a couple of problems with the Internet Explorer browser control. I'm using VS.NET 2003 on Win2k SP4 with IE6. First,...
by: jmi0 | last post by:
I want to create a custom user control to be used in a web page (by object tag) as an assembly. The user control needs to have a web browser...
by: Tosco | last post by:
I'm new to VB.net and I want to upgrade an application from VB6 to VB2005. The VB6 application uses an invisible WebBrowser control to access some...
by: yxq | last post by:
Hello, I want to kill the Explorer process, after Explorer process has been killed, it will restart automatically immediately. How to disable it...
by: Almund | last post by:
Hi, Since a while back PosgreSQL have started to hang making interaction with it impossible. The process still remains in the taskmanager aswell as...
by: beyrself | last post by:
Public Function RsReDir() 'function to restart dns redirector - working as of 12-11-08' Dim plist As Process() = Process.GetProcesses() 'Get and...
by: tammygombez | last post by:
Hey fellow JavaFX developers, I'm currently working on a project that involves using a ComboBox in JavaFX, and I've run into a bit of an issue....
by: tammygombez | last post by:
Hey everyone! I've been researching gaming laptops lately, and I must say, they can get pretty expensive. However, I've come across some great...
by: concettolabs | last post by:
In today's business world, businesses are increasingly turning to PowerApps to develop custom business applications. PowerApps is a powerful tool...
by: teenabhardwaj | last post by:
How would one discover a valid source for learning news, comfort, and help for engineering designs? Covering through piles of books takes a lot of...
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
by: CD Tom | last post by:
This happens in runtime 2013 and 2016. When a report is run and then closed a toolbar shows up and the only way to get it to go away is to right...
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was...
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.