Understanding Error Handling in COM Interop

COM Interop supports error handling from .NET to COM and from COM to .NET. Each HResult in COM is mapped to a .NET exception. Hence, if an exception is thrown in a .NET source, the CCW maps the exception to an HResult using the ISupportErrorInfo interface, which results in an Err object being created in VB6. If a VB6 COM source raises an error, the RCW converts the VB6 COM HResult into a .NET exception, and the mapped exception is thrown in .NET. Check out the VS .NET help topic ms-help://MS.VSCC/MS.MSDNVS/cpguide/html/cpconhresultsexceptions.htm for a complete mapping between HResult values and .NET exception classes.



Visual Basic. NET Power Coding
Visual Basic(R) .NET Power Coding
ISBN: 0672324075
EAN: 2147483647
Year: 2005
Pages: 215
Authors: Paul Kimmel

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net