|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
How to have a clean exitI get an annoying error message when I close my program. It does not seem to
affect what I'm doing in my program so that's why I saying annoying. Is there a way to prevent the message from showing when I exit?? Here is the message... ----------------------------------- ..NET-BroadcastEventWindow.1.0.5000.0.3:HisHandsReader.exe - Application Error The instruction at "0x3009d524" referenced memory at "0x0000001c". The memory could not be "read". Click on OK to terminate the program. ----------------------------------- Hi,
I would start my application from sub main and place the application.run in a try catch block. Hopefully that will catch the error. I found a few similiar questions on the internet. The other people had were using the axwebbrowser control on the form. I was wondering if that applied to you? Try Application.Run(new Form1) Catch End try Ken ----------- Show quoteHide quote "BobAchgill" wrote: > I get an annoying error message when I close my program. It does not seem to > affect what I'm doing in my program so that's why I saying annoying. Is > there a way to prevent the message from showing when I exit?? Here is the > message... > > ----------------------------------- > > .NET-BroadcastEventWindow.1.0.5000.0.3:HisHandsReader.exe - Application Error > > The instruction at "0x3009d524" referenced memory at "0x0000001c". The > memory could not be "read". > Click on OK to terminate the program. > ----------------------------------- Thanks! Yes, the error IS related to using the webbrowser. What search
string did you Google to find what others are saying? Bob Show quoteHide quote "Ken Tucker [MVP]" wrote: > Hi, > > I would start my application from sub main and place the > application.run in a try catch block. Hopefully that will catch the error. > I found a few similiar questions on the internet. The other people had were > using the axwebbrowser control on the form. I was wondering if that applied > to you? > > Try > Application.Run(new Form1) > Catch > End try > > Ken > ----------- > > "BobAchgill" wrote: > > > I get an annoying error message when I close my program. It does not seem to > > affect what I'm doing in my program so that's why I saying annoying. Is > > there a way to prevent the message from showing when I exit?? Here is the > > message... > > > > ----------------------------------- > > > > .NET-BroadcastEventWindow.1.0.5000.0.3:HisHandsReader.exe - Application Error > > > > The instruction at "0x3009d524" referenced memory at "0x0000001c". The > > memory could not be "read". > > Click on OK to terminate the program. > > ----------------------------------- Hi,
Here is the search string http://www.google.com/search?q=BroadcastEventWindow+.net&start=0&ie=utf-8&oe=utf-8&client=firefox-a&rls=org.mozilla:en-US:official Ken ---------------------------------- Show quoteHide quote "BobAchgill" wrote: > Thanks! Yes, the error IS related to using the webbrowser. What search > string did you Google to find what others are saying? > > Bob > > "Ken Tucker [MVP]" wrote: > > > Hi, > > > > I would start my application from sub main and place the > > application.run in a try catch block. Hopefully that will catch the error. > > I found a few similiar questions on the internet. The other people had were > > using the axwebbrowser control on the form. I was wondering if that applied > > to you? > > > > Try > > Application.Run(new Form1) > > Catch > > End try > > > > Ken > > ----------- > > > > "BobAchgill" wrote: > > > > > I get an annoying error message when I close my program. It does not seem to > > > affect what I'm doing in my program so that's why I saying annoying. Is > > > there a way to prevent the message from showing when I exit?? Here is the > > > message... > > > > > > ----------------------------------- > > > > > > .NET-BroadcastEventWindow.1.0.5000.0.3:HisHandsReader.exe - Application Error > > > > > > The instruction at "0x3009d524" referenced memory at "0x0000001c". The > > > memory could not be "read". > > > Click on OK to terminate the program. > > > ----------------------------------- This what I found at one of the links... something about a piece of
AxWebbrowser hanging around forever in memory after closing a forms application that has axwebbrowser imbedded. I guess the Try blocks you suggest will help cosmetically by supressing the message but will the issue of the memory decay be a problem. I followed the link that this guy suggests for the fix but I did not understand the code. It did not apprear to be VB ..net code. Here it is ... +++++++++++++++++++++++++++++++++++ Surprisingly I did find a work-around on a blog. It appears the Web Browser control's .WindowClosing() event doesn't fire, so the Web Browser control hangs out in memory after the Managed .NET Form is long gone. Apparently the error is thrown when the Web Browser control attempts to contact the Managed ..NET Form which no longer exists. Anyway, here's the workaround: http://www.kbcafe.com/iBLOGthere4iM/?guid=20040501150250[^] Hmmm. Hope that HTML link comes out OK. If not, here it is in copy-n-paste plain text format: http://www.kbcafe.com/iBLOGthere4iM/?guid=20040501150250 ++++++++++++++++++++++++++++++++++++++++
Show quote
Hide quote
"BobAchgill" <BobAchg***@discussions.microsoft.com> wrote in message This is because it's written in C++ and not VB :)news:E9F6D93B-9426-4792-9CAC-9577C79AD2C8@microsoft.com... > > This what I found at one of the links... something about a piece of > AxWebbrowser hanging around forever in memory after closing a forms > application that has axwebbrowser imbedded. I guess the Try blocks you > suggest will help cosmetically by supressing the message but will the > issue > of the memory decay be a problem. I followed the link that this guy > suggests > for the fix but I did not understand the code. It did not apprear to be > VB > .net code. > All the code is telling you to do is to inherit from SHDocVw.DWebBrowserEvents2 and implement the method WindowClosing. So...in other words (and not testing this code, just re-writing in VB for ya): Public (override??) Sub WindowClosing( _ ByVal IsChildWindow As Boolean, _ ByRef Cancel As Boolean _ ) MsgBox("WindowClosing") End Sub At the end of InitializeComponent method: Dim pConPtCon As UCOMIConnectionPointContainer = DirectCast( _ Me.axWebBrowser1.GetOcx(), _ UCOMIConnectionPointContainer _ ) Dim pConPt As UCOMIConnectionPoint Dim guid As GUID = GetType(SHDocVw.DWebBrowserEvents2).GUID pConPtCon.FindConnectionPoint(guid, pConPt) IEEvents e = new IEEvents() ' Make sure you declare private int dwCookie in the form class, but outside ' this method. pConPt.Advise(e, dwCookie) -------- Add the following lines of code to the beginning of the Forms Close handler method. Dim pConPtCon As UCOMIConnectionPointContainer = DirectCast( _ Me.axWebBrowser1.GetOcx(), _ UCOMIConnectionPointContainer _ ) Dim pConPt As UCOMIConnectionPoint Dim guid As Guid = GetType(SHDocVw.DWebBrowserEvents2).GUID pConPtCon.FindConnectionPoint(guid, pConPt) pConPt.Unadvise(dwCookie) --------- Once again, I haven't tested this, and wrote it using the code from the link previously provided. Take not the comment regarding dwCookie inline in the re-written code. HTH :) Mythran I also saw something mentioned about trying Marshal.ReleaseComObject() but
not sure how to use that method. Here is the mention... ---------------------- I've run it on 7 machines so far with varying configurations, with the exact same results. That leads me to believe it's not a configuration problem. It looks to me like the unmanaged component is trying to send messages to the managed code immediately after the managed code has been unloaded. I.e., the managed code is unloading faster than the unmanaged code, and this is the root of the problem. I'm going to try to Marshal.ReleaseComObject() and see if that will release the COM component a little more quickly. Thanks, Michael C., MCDBA http://www.dotnetmonster.com/Uwe/Forum.aspx/dotnet-csharp/25898/Error-when-closing-application --------------------------------------- Hi,
If you can try to use vb 2005 it has a managed version of the webbrowser control. VB express is a free product. Ken --------------------- Show quoteHide quote "BobAchgill" wrote: > I also saw something mentioned about trying Marshal.ReleaseComObject() but > not sure how to use that method. Here is the mention... > ---------------------- > I've run it on 7 machines so far with varying configurations, with the exact > same results. That leads me to believe it's not a configuration problem. > It looks to me like the unmanaged component is trying to send messages to > the managed code immediately after the managed code has been unloaded. > I.e., the managed code is unloading faster than the unmanaged code, and this > is the root of the problem. I'm going to try to Marshal.ReleaseComObject() > and see if that will release the COM component a little more quickly. > > Thanks, > Michael C., MCDBA > > > http://www.dotnetmonster.com/Uwe/Forum.aspx/dotnet-csharp/25898/Error-when-closing-application > ---------------------------------------
But what about them hackers?
Resetting the value of a System.Web.UI.HtmlControls.HtmlInputFile Order of events, databinding, and UserControls Ayuda contra unos programadores de Linux y PHP que me quieren dañar un negocio Really puzzled (or maybe just totally confused) about VB.NET and ADO.NET AppStartup "Cancel" leaves splash form loaded Stepping through datagridview rows in code Word automation version problem. Setting tab stops in RTF control Custom Datagridstyle |
|||||||||||||||||||||||