473,406 Members | 2,705 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,406 software developers and data experts.

Catch Win32 Exception from unmanaged code

dh
AppA is a console application (in C#), which uses DLLs in a unmanaged code
(C++, no source available for them).

AppB is a service (in C#), which starts AppA when needed.

When an exception of Win32 (e.g. Integer Division by Zero) thrown by those
DLLs, it will pop up an errorbox waiting for responses.

Just wondering if it's possible for either AppA itself or AppB to catch such
exceptions immediately when it occurs.

Any idea?

Thanks!
Jan 26 '08 #1
1 7480
On 26 ÑÎ×, 22:00, "dh" <d...@yahoo.comwrote:
AppA is a console application (in C#), which uses DLLs in a unmanaged code
(C++, no source available for them).

AppB is a service (in C#), which starts AppA when needed.

When an exception of Win32 (e.g. Integer Division by Zero) thrown by those
DLLs, it will pop up an errorbox waiting for responses.

Just wondering if it's possible for either AppA itself or AppB to catch such
exceptions immediately when it occurs.

Any idea?

Thanks!
Hi,

In case of integer division by zero the exception should be converted
to the native .NET System.DivideByZeroException.
In general case if the exception will be converted to
System.Runtime.InteropServices.SEHException (you can look into MSDN to
see how exceptions are converted).
So I think you can catch them in AppA and probably it would be better
to check input so divide by zero exception doesn't occur.

HTH,
Sergey Zyuzin
Jan 26 '08 #2

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

Similar topics

5
by: David | last post by:
I am having a bit of a problem with catching an exception within a thread. Here is the scenario: I have a Windows Form. I create a new thread. This new thread calls a method in another DLL...
8
by: Z D | last post by:
Hi, I was wondering what's the point of "finally" is in a try..catch..finally block? Isn't it the same to put the code that would be in the "finally" section right after the try/catch block?...
9
by: Steven Blair | last post by:
Hi, I need to catch exceotions on File.Delete() After checking the help, I have noticed that thgere are serevral Exceptions that can be thrown. My question is, should I catch all thes...
13
by: Benny | last post by:
Hi, I have something like this: try { // some code } catch // note - i am catching everything now {
11
by: Tamas Demjen | last post by:
I was shocked to learn that VC++ 2005 Beta 2 can't catch Access Violation exceptions in unmanaged code. To reproduce this, I created a minimal Win32 console application: #include "stdafx.h" ...
9
by: Bob Achgill | last post by:
I really like this function but have tried to slow down on using it because I get a 1 second pause each time I use it. I don't really understand why the computer has to think for 1 second! ...
0
by: Chrisg | last post by:
Hi, I am using some unmanaged dll's written in C++ in vb.net. Is there a way to trap errors that the unmanaged code raises. My calls to the unmanaged world work and I have them in a Try...Catch...
2
by: pack | last post by:
Is "catch" in C# going to catch all exception, or it just catch the exceptions induced by "throw"? Will it also catch those "structured exceptions" that could be either from system modules or other...
6
by: R.Kaiser | last post by:
I know that I can call Win32 API functions in a Windows forms application by specifying each function header individually like in using namespace System; using namespace...
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
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...

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.