Passing SAFEARRAYS through COM events
-
Hi, I'm using ATL and have written an event that passes a SAFEARRAY (of doubles) back to the client as one of its parameters In the IDL file I've declared this as: [id(2), helpstring("method SpoilValuesReadyEvent")] HRESULT TFASpoilsReadyEvent(SAFEARRAY(double)* a, double b, double c); producing: HRESULT Fire_TFASpoilsReadyEvent(SAFEARRAY * * a, DOUBLE b, DOUBLE c) etc... in the proxy file. I'm testing the code from a VB client. The client produces: Private Sub test_TFASpoilsReadyEvent(a() As Double, ByVal b As Double, ByVal c As Double) This all seems to be OK. However, when I fire the event, it is not caught by the client. Is there any reason for this apart from probable incompetence ? :((
-
Hi, I'm using ATL and have written an event that passes a SAFEARRAY (of doubles) back to the client as one of its parameters In the IDL file I've declared this as: [id(2), helpstring("method SpoilValuesReadyEvent")] HRESULT TFASpoilsReadyEvent(SAFEARRAY(double)* a, double b, double c); producing: HRESULT Fire_TFASpoilsReadyEvent(SAFEARRAY * * a, DOUBLE b, DOUBLE c) etc... in the proxy file. I'm testing the code from a VB client. The client produces: Private Sub test_TFASpoilsReadyEvent(a() As Double, ByVal b As Double, ByVal c As Double) This all seems to be OK. However, when I fire the event, it is not caught by the client. Is there any reason for this apart from probable incompetence ? :((
Why don't you catch the error and get a error description of the failure, this way we might be able to help you ?
-
Hi, I'm using ATL and have written an event that passes a SAFEARRAY (of doubles) back to the client as one of its parameters In the IDL file I've declared this as: [id(2), helpstring("method SpoilValuesReadyEvent")] HRESULT TFASpoilsReadyEvent(SAFEARRAY(double)* a, double b, double c); producing: HRESULT Fire_TFASpoilsReadyEvent(SAFEARRAY * * a, DOUBLE b, DOUBLE c) etc... in the proxy file. I'm testing the code from a VB client. The client produces: Private Sub test_TFASpoilsReadyEvent(a() As Double, ByVal b As Double, ByVal c As Double) This all seems to be OK. However, when I fire the event, it is not caught by the client. Is there any reason for this apart from probable incompetence ? :((
Hi, there is no error generated as such. The problems I'm having centre around: 1. The IDL complaining that an interface doesn't support automation. 2. The interface being seeminly ok until I try to use it in a client. The client (i'm testing in VB) will try to implement the event handler and either not catch it or crash at the first line of code in the handler. Judging by other stuff i've seen on the net there seems to be a problem with passing SAFEARRAYS and VARIANTS through event interfaces.
-
Hi, there is no error generated as such. The problems I'm having centre around: 1. The IDL complaining that an interface doesn't support automation. 2. The interface being seeminly ok until I try to use it in a client. The client (i'm testing in VB) will try to implement the event handler and either not catch it or crash at the first line of code in the handler. Judging by other stuff i've seen on the net there seems to be a problem with passing SAFEARRAYS and VARIANTS through event interfaces.
download this sample from chris sells site http://www.sellsbrothers.com/tools/CComSafeArray.zip This has a excellent sample that uses Safearray between C++ and VB But... Looking at your code, everthing seems to be OK. It may be that you have some basic COM security problems. i.e. your server machine does not have the rights to fire data at your client machine.