COM and Exceptions
-
Hi All, I am currently working on a XML interface to my application. I have implemented this as a COM interface, usable from within any language such as VBS, C/C++, etc. The problem is that some customers ask me to throw exceptions from within that COM interface, to be catched at the upper level from where the COM was instantiated. Does anyone know if this is possible at all, and if so, give me some pointers / hints in how to implement such a thing? Thanks a lot in advance! Perry Bruins (Netherlands)
-
Hi All, I am currently working on a XML interface to my application. I have implemented this as a COM interface, usable from within any language such as VBS, C/C++, etc. The problem is that some customers ask me to throw exceptions from within that COM interface, to be catched at the upper level from where the COM was instantiated. Does anyone know if this is possible at all, and if so, give me some pointers / hints in how to implement such a thing? Thanks a lot in advance! Perry Bruins (Netherlands)
All exceptions MUST be handled within the component, the only thing you can do is to pass back a HRESULT to indicate what happened. Of course, if you're passing back XML, you can pass back any other info you like, but you'll need to check the HRESULT for success, you simply cannot be throwing excpetions across processes or machines. Christian I am completely intolerant of stupidity. Stupidity is, of course, anything that doesn't conform to my way of thinking. - Jamie Hale - 29/05/2002 Half the reason people switch away from VB is to find out what actually goes on.. and then like me they find out that they weren't quite as good as they thought - they've been nannied. - Alex, 13 June 2002
-
All exceptions MUST be handled within the component, the only thing you can do is to pass back a HRESULT to indicate what happened. Of course, if you're passing back XML, you can pass back any other info you like, but you'll need to check the HRESULT for success, you simply cannot be throwing excpetions across processes or machines. Christian I am completely intolerant of stupidity. Stupidity is, of course, anything that doesn't conform to my way of thinking. - Jamie Hale - 29/05/2002 Half the reason people switch away from VB is to find out what actually goes on.. and then like me they find out that they weren't quite as good as they thought - they've been nannied. - Alex, 13 June 2002
Thanks a lot for your answer. I already thought it was not possible, but now I know for sure. Perry