473,883 Members | 1,589 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

axwebbrowser1.d ispose()

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.Resource s.ResourceManag er resources = new System.Resource s.ResourceManag er(typeof(frmMa in));
this.axWebBrows er1 = new AxSHDocVw.AxWeb Browser();

// Tell the axwebbrowser that the main form controls the ie :)
object obj = axWebBrowser1.G etOcx();
IOleObject oc = obj as IOleObject;
oc.SetClientSit e(this);

// Some events we want to have
ie_events = (SHDocVw.WebBro wserClass) Marshal.CreateW rapperOfType(ax WebBrowser1.Get Ocx(), typeof(SHDocVw. WebBrowserClass ));
SHDocVw.DWebBro wserEvents_Befo reNavigateEvent Handler BeforeNavigateE = new SHDocVw.DWebBro wserEvents_Befo reNavigateEvent Handler(OnBefor eNavigate);
ie_events.Befor eNavigate += BeforeNavigateE ;

// The basic stuff to set the axwebbrowser into the form
((System.Compon entModel.ISuppo rtInitialize)(t his.axWebBrowse r1)).BeginInit( );
this.panel1.Con trols.Add(this. axWebBrowser1);
this.axWebBrows er1.ContainingC ontrol = this;
this.axWebBrows er1.Dock = System.Windows. Forms.DockStyle .Fill;
this.axWebBrows er1.Enabled = true;
this.axWebBrows er1.Location = new System.Drawing. Point(0, 0);
this.axWebBrows er1.OcxState = ((System.Window s.Forms.AxHost. State)(resource s.GetObject("ax WebBrowser1.Ocx State")));
this.axWebBrows er1.Size = new System.Drawing. Size(100, 100);
this.axWebBrows er1.TabIndex = 0;
this.axWebBrows er1.NavigateCom plete2 += new AxSHDocVw.DWebB rowserEvents2_N avigateComplete 2EventHandler(t his.axWebBrowse r1_NavigateComp lete2);
((System.Compon entModel.ISuppo rtInitialize)(t his.axWebBrowse r1)).EndInit();
If i remove the oc.setclientsit e(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, idochostuihandl er, ioledocumentsit e and idochostshowui methods.
at the idochostuihandl er 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(t his, 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 ;)


thanks

Matthias
Nov 15 '05 #1
0 2920

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

Similar topics

10
7453
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 and to send email. Set objWshell = Server.CreateObject("WScript.Shell") objWshell.Run "%COMSPEC% /C kill iexplore.exe", 0, TRUE VILMAR BRAZIL
1
322
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
4
2352
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 it. I am working in a web application with ASP.NET. Recently, I group of user have problems with it because the values of the sessions were not stored correctly (the application save the username in a login page, then other page try to get it and the result was always ""). We restart the web...
2
3117
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, let me briefly describe how it's used in my project. 1. I have a DLL containing a form which hosts the IE Browser control, using the AxInterop stuff that is generated when you add a reference to the COM ShDocVw
1
4508
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 control in it. Having tried with the managed System.Windows.Forms.WebBrowser or AxSHDocVw.AxWebBrowser, none of them worked from IE invocation unfortunately. While System.Windows.Forms.WebBrowser showed the page in Visual Studio 5000 Designer, AxSHDocVw.AxWebBrowser caught an exception at Navigate...
27
1662
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 pages and parse the content. Is there a better way with VB2005? Nothing wrong with the WebBrowser (besides the memory leaks), but since I don't need to show any web page content I was wondering if there is a ligher way. Thanks,
4
7185
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 restart automatically? for example, in Windows Task Manager, you can kill explorer process, but it will not restart automatically. My code: ///////////////////////////////////////////// For Each ObjPro As Process In Process.GetProcessesByName("EXPLORER")
0
3970
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 another process with the same name (which i guess is the service trying to restart but failing). The process that remains I cannot kill however i try, I get a message 'The operation could not be completed. Access is denied.' from taskmanager even though I'm in administrator mode. I've tried to...
1
4066
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 parse list of processes to plist' For Each p As Process In plist 'parse each entry in plist as p process' Try If p.MainModule.ModuleName.ToLower() = "dnsredir.exe" Then p.Kill() 'If module name of process matches "dnsredir.exe" then kill p'
0
9943
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9793
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10858
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7974
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5804
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5996
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4619
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4225
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3237
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.