Click here to Skip to main content
15,890,185 members
Home / Discussions / C#
   

C#

 
GeneralRe: Catch C++ exception in C# Pin
Not Knuth15-Oct-07 7:22
Not Knuth15-Oct-07 7:22 
GeneralRe: Catch C++ exception in C# Pin
led mike15-Oct-07 7:45
led mike15-Oct-07 7:45 
GeneralRe: Catch C++ exception in C# Pin
Not Knuth15-Oct-07 8:00
Not Knuth15-Oct-07 8:00 
GeneralRe: Catch C++ exception in C# Pin
led mike15-Oct-07 8:05
led mike15-Oct-07 8:05 
GeneralRe: Catch C++ exception in C# Pin
Not Knuth15-Oct-07 8:15
Not Knuth15-Oct-07 8:15 
AnswerRe: Catch C++ exception in C# Pin
Liam O'Hagan15-Oct-07 20:57
Liam O'Hagan15-Oct-07 20:57 
GeneralRe: Catch C++ exception in C# Pin
Not Knuth16-Oct-07 5:26
Not Knuth16-Oct-07 5:26 
AnswerRe: Catch C++ exception in C# Pin
Marshall16-Oct-07 6:11
Marshall16-Oct-07 6:11 
Not Knuth wrote:
I can not change the code in the DLL. How can I catch these (C++) exceptions and get the string info they contain?


I have recently encountered a similar situation. After a good bit of research and testing I can tell you that the best approach is to wrap the DLL in a managed assembly where you catch the C++ exception and then throw a managed exception in its place. (As described previously in the reply from led mike.)

You can grab the string out of the C++ exception and insert it in one of the exception classes defined in the framework or in your own derived from one of them. The framework doesn't provide any method to automatically marshal the string message in a C++ exception to a managed object.

Marshall

If you continue to do the same things you always did,
don't be surprised if you get the same results you always got.

GeneralRe: Catch C++ exception in C# Pin
Not Knuth16-Oct-07 7:47
Not Knuth16-Oct-07 7:47 
QuestionPrevent Monitor Standby and ScreenSaver Activation Pin
Sukhjinder_K15-Oct-07 6:05
Sukhjinder_K15-Oct-07 6:05 
AnswerRe: Prevent Monitor Standby and ScreenSaver Activation Pin
led mike15-Oct-07 6:42
led mike15-Oct-07 6:42 
GeneralSome code which can do the trick Pin
Sukhjinder_K15-Oct-07 6:58
Sukhjinder_K15-Oct-07 6:58 
GeneralRe: Some code which can do the trick Pin
Skippums15-Oct-07 7:30
Skippums15-Oct-07 7:30 
GeneralRe: Some code which can do the trick Pin
Sukhjinder_K15-Oct-07 18:35
Sukhjinder_K15-Oct-07 18:35 
GeneralRe: Some code which can do the trick Pin
Skippums16-Oct-07 5:05
Skippums16-Oct-07 5:05 
GeneralRe: Some code which can do the trick Pin
led mike15-Oct-07 7:41
led mike15-Oct-07 7:41 
GeneralNew to C# and Writing Media Player Pin
Sukhjinder_K15-Oct-07 17:03
Sukhjinder_K15-Oct-07 17:03 
GeneralRe: Some code which can do the trick Pin
Hariharan.R16-Oct-07 2:31
Hariharan.R16-Oct-07 2:31 
AnswerSolution Pin
Sukhjinder_K16-Oct-07 18:27
Sukhjinder_K16-Oct-07 18:27 
QuestionHow to read JavaScript's variables values in webBrowser control using C# Pin
A.Asif15-Oct-07 5:41
A.Asif15-Oct-07 5:41 
AnswerRe: How to read JavaScript's variables values in webBrowser control using C# Pin
led mike15-Oct-07 6:36
led mike15-Oct-07 6:36 
GeneralRe: How to read JavaScript's variables values in webBrowser control using C# Pin
A.Asif15-Oct-07 9:30
A.Asif15-Oct-07 9:30 
GeneralRe: How to read JavaScript's variables values in webBrowser control using C# Pin
leppie16-Oct-07 2:45
leppie16-Oct-07 2:45 
GeneralRe: How to read JavaScript's variables values in webBrowser control using C# Pin
A.Asif16-Oct-07 3:34
A.Asif16-Oct-07 3:34 
QuestionGetting text from one form into second form Pin
MumbleB15-Oct-07 5:37
MumbleB15-Oct-07 5:37 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.