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. COM
  4. VC++ ATL Server, VB Client, VARIANTs and SAFEARRAYs ??

VC++ ATL Server, VB Client, VARIANTs and SAFEARRAYs ??

Scheduled Pinned Locked Moved COM
questionc++comsysadmintesting
3 Posts 2 Posters 10 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.
  • L Offline
    L Offline
    Lost User
    wrote on last edited by
    #1

    COM. I realize that I have to use automation-compatible data types such as VARIANTs and SAFEARRAYs. However, I'm having difficulty figuring-out exactly how to define the method in IDL and interpret the data on the server side. The data is a set of 29 variables, most of which are integers. Some are floats, with one string and couple of arrays thrown in for good measure. Obviously it would be tedious to set-up and use a method with 29 parameters. So, I'd like to pass all of the data in one chunk if I can. Additionally, there will be 2 other chunks of data returned to the client in the same method ... but that's a different question. The only thing I'm trying to do now is get the chunk of data to the server. In all that I've read, it seems that the best way to pass the chunks of data is using arrays of VARIANTs. Is that true ? If so, how do I define the method interface in IDL and how do I unpack the data on the server ? Any guidance would be helpful. Thank you, Keith Gemeinhart

    A 1 Reply Last reply
    0
    • L Lost User

      COM. I realize that I have to use automation-compatible data types such as VARIANTs and SAFEARRAYs. However, I'm having difficulty figuring-out exactly how to define the method in IDL and interpret the data on the server side. The data is a set of 29 variables, most of which are integers. Some are floats, with one string and couple of arrays thrown in for good measure. Obviously it would be tedious to set-up and use a method with 29 parameters. So, I'd like to pass all of the data in one chunk if I can. Additionally, there will be 2 other chunks of data returned to the client in the same method ... but that's a different question. The only thing I'm trying to do now is get the chunk of data to the server. In all that I've read, it seems that the best way to pass the chunks of data is using arrays of VARIANTs. Is that true ? If so, how do I define the method interface in IDL and how do I unpack the data on the server ? Any guidance would be helpful. Thank you, Keith Gemeinhart

      A Offline
      A Offline
      Alex Gorev
      wrote on last edited by
      #2

      Hi Keith, You absolutely right... You have an option of passing 29 parameters to the method or you can use safearray. But safearrays are difficult to work with if you have different type of data like integers and strings... The third option you have, which is the best if you have very complicated data that you need to pass/return to/from the method, is to use a COM object. You create a COM object with the different type of properties and pass/return it by interface pointer. The big advantage is that you can access the properties by names and even associate help strings with each property. The only issue is the performance... if you need to make many calls to such a method, it will take a lot of time to create and initialize the parameters object. Regards, Alex Gorev, Dundas Software.

      L 1 Reply Last reply
      0
      • A Alex Gorev

        Hi Keith, You absolutely right... You have an option of passing 29 parameters to the method or you can use safearray. But safearrays are difficult to work with if you have different type of data like integers and strings... The third option you have, which is the best if you have very complicated data that you need to pass/return to/from the method, is to use a COM object. You create a COM object with the different type of properties and pass/return it by interface pointer. The big advantage is that you can access the properties by names and even associate help strings with each property. The only issue is the performance... if you need to make many calls to such a method, it will take a lot of time to create and initialize the parameters object. Regards, Alex Gorev, Dundas Software.

        L Offline
        L Offline
        Lost User
        wrote on last edited by
        #3

        Thanks for your reply. I have solved the problem ... and in the near future, I will post a short description of how I did it. -Keith

        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