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
  1. Home
  2. General Programming
  3. ATL / WTL / STL
  4. SafeArrays (newbie)

SafeArrays (newbie)

Scheduled Pinned Locked Moved ATL / WTL / STL
comgraphicssysadmindata-structuresdebugging
3 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.
  • D Offline
    D Offline
    De Nardis Andrea
    wrote on last edited by
    #1

    Hi all, I have to pass a safearray to my DLL COM server. the method must size the array, and then fill with data. After that the client must use the data the server has inserted. I suspect my passed array is a copy of the one sent by the VB client, so my VB client does not access the data. how I have to modify my MIDL lines in order to have the safearray shared? I am using: [id(1), helpstring("method GetPosition")] HRESULT GetPosition(VARIANT arrayPosition); arrayPosition is a vector of double like this: Dim arrayPosition as Double (0 to 9) Dim a As New RunTimeAx a.GetPosition arrayPosition Debug.Print arrayPosition (0) Debug.Print arrayPosition (1) Debug.Print arrayPosition (2) Debug.Print arrayPosition (3) Could you pls help me? Thanx in advance

    M 1 Reply Last reply
    0
    • D De Nardis Andrea

      Hi all, I have to pass a safearray to my DLL COM server. the method must size the array, and then fill with data. After that the client must use the data the server has inserted. I suspect my passed array is a copy of the one sent by the VB client, so my VB client does not access the data. how I have to modify my MIDL lines in order to have the safearray shared? I am using: [id(1), helpstring("method GetPosition")] HRESULT GetPosition(VARIANT arrayPosition); arrayPosition is a vector of double like this: Dim arrayPosition as Double (0 to 9) Dim a As New RunTimeAx a.GetPosition arrayPosition Debug.Print arrayPosition (0) Debug.Print arrayPosition (1) Debug.Print arrayPosition (2) Debug.Print arrayPosition (3) Could you pls help me? Thanx in advance

      M Offline
      M Offline
      Mike Dimmick
      wrote on last edited by
      #2

      You probably want

      HRESULT GetPosition([in, out] VARIANT* pArrayPosition);

      or even, if the caller won't ever pass anything interesting in:

      HRESULT GetPosition([out, retval] VARIANT* pArrayPosition);

      In the second case, you would transform your VB code to

      Dim arrayPosition As Variant
      Dim a As New RunTimeAx
      arrayPosition = a.GetPosition
      Debug.Print arrayPosition (0)
      ' etc

      (You might need to use Set, I haven't used VB for a while). Stability. What an interesting concept. -- Chris Maunder

      D 1 Reply Last reply
      0
      • M Mike Dimmick

        You probably want

        HRESULT GetPosition([in, out] VARIANT* pArrayPosition);

        or even, if the caller won't ever pass anything interesting in:

        HRESULT GetPosition([out, retval] VARIANT* pArrayPosition);

        In the second case, you would transform your VB code to

        Dim arrayPosition As Variant
        Dim a As New RunTimeAx
        arrayPosition = a.GetPosition
        Debug.Print arrayPosition (0)
        ' etc

        (You might need to use Set, I haven't used VB for a while). Stability. What an interesting concept. -- Chris Maunder

        D Offline
        D Offline
        De Nardis Andrea
        wrote on last edited by
        #3

        Thanx a lot Mike, when you come in Italy I'll offer you a beer. Thanx again. ;)

        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