HResult in c#

  • Thread starter Thread starter Manoj
  • Start date Start date
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
 
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.
 
Back
Top