Click here to Skip to main content
15,899,126 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I'm using a book, "insisde c#" by archer and whitechapel for some self-education. It may not be the very latest, but it's all I have at the moment. I'm trying to create an Error object in a COM component that the RCW will translate into a COMException in a managed consumer, like a C# program. Part of it seems to work - the ErrorCode. The message doesn't. I get "Invalid pointer <exception from HRESULT 0x8....5>" instead of the actual message.

I've scoured the net looking for info on the Error Object, the first parameter, and COMException, but there doesn't seem to be much. At least not enough to explain the "invalid pointer..." message. Any help - thanks in advance.

In my COM component:

return Error(LPCSTR(
    _T("Airline Timings not available for this Airline" )),
    __uuidof(AirlineInfo), AirlineError);


In my C# consumer:

catch (COMException e)
{
    Console.WriteLine("Oops, an error occured!"; +
       "Error Code is: {0}. Error message is : {1}",
        e.ErrorCode, e.Message);
}
Posted
Updated 10-Aug-10 17:43pm
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900