Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. COM
  4. Passing SAFEARRAYS through COM events

Passing SAFEARRAYS through COM events

Scheduled Pinned Locked Moved COM
c++comtestingbeta-testingquestion
4 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    Rick Dangerous
    wrote on last edited by
    #1

    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 ? :((

    R R 2 Replies Last reply
    0
    • R Rick Dangerous

      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 ? :((

      R Offline
      R Offline
      Rashid Thadha
      wrote on last edited by
      #2

      Why don't you catch the error and get a error description of the failure, this way we might be able to help you ?

      1 Reply Last reply
      0
      • R Rick Dangerous

        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 ? :((

        R Offline
        R Offline
        Rick Dangerous
        wrote on last edited by
        #3

        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.

        R 1 Reply Last reply
        0
        • R Rick Dangerous

          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.

          R Offline
          R Offline
          Rashid Thadha
          wrote on last edited by
          #4

          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.

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups