473,396 Members | 1,779 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

How to have a clean exit

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.e xe - Application Error

The instruction at "0x3009d524" referenced memory at "0x0000001c". The
memory could not be "read".
Click on OK to terminate the program.
-----------------------------------
May 22 '06 #1
7 2313
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.e xe - Application Error

The instruction at "0x3009d524" referenced memory at "0x0000001c". The
memory could not be "read".
Click on OK to terminate the program.
-----------------------------------

May 22 '06 #2
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.e xe - Application Error

The instruction at "0x3009d524" referenced memory at "0x0000001c". The
memory could not be "read".
Click on OK to terminate the program.
-----------------------------------

May 22 '06 #3
Hi,

Here is the search string

http://www.google.com/search?q=Broad...en-US:official

Ken
----------------------------------

"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.e xe - Application Error

The instruction at "0x3009d524" referenced memory at "0x0000001c". The
memory could not be "read".
Click on OK to terminate the program.
-----------------------------------

May 22 '06 #4

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/...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/...20040501150250

++++++++++++++++++++++++++++++++++++++++

May 22 '06 #5
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/For...ng-application
---------------------------------------
May 22 '06 #6

"BobAchgill" <Bo********@discussions.microsoft.com> wrote in message
news:E9**********************************@microsof t.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.


This is because it's written in C++ and not VB :)

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

May 22 '06 #7
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
---------------------

"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/For...ng-application
---------------------------------------

May 22 '06 #8

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

Similar topics

15
by: lallous | last post by:
Hello, I have a function like: void fnc() { char *mem1, *mem2, *mem3, *mem4; // lots of code... // mem1, 2, 3, 4 got allocated // lots of code and condition checks if (condition_failed)
10
by: lallous | last post by:
Hello, This question was asked in comp.lang.c++ and the answers involved the use of objects whose destructors are automatically called when getting out of scope, however I was expecting...
6
by: Sandy | last post by:
Hello - I have a little application that I would like to have an exit button on that closes my web application and closes Internet Explorer. What is the code that will do that? Any help...
3
by: faz | last post by:
Hai, i have used exit(1) in my code and included conio.h file also but it is giving the following.. error C2065: 'exit' : undeclared identifier pls suggest me
8
by: =?Utf-8?B?bXVzb3NkZXY=?= | last post by:
Hi I've just come back to a project I've had a week or so off from, haven't touched it, and it seemed to be working fine when I left it. However, it's not compiling!! Here's the...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
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,...
0
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.