HResult in c#

M

Manoj

Hi,
In our application we reference com components written in c++.When errors
occur the messages appear like this

'Exception from HRESULT: 0xC0068002"

is there a way to convert this HResult value string (0xC0068002) and convert
it into an int value

thanks in advance
Manoj Nair
 
D

Dave

The exception being thrown is of the Type, "System.Runtime.InteropServices.COMException".

Your Try...Catch blocks should be explicitly catching this type of exception when calling unmanaged functions.
The class has a property, "ErrorCode" that returns the HResult as an int.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top