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. How To pass structure or complex data in IDispatch using invoke() method [modified]

How To pass structure or complex data in IDispatch using invoke() method [modified]

Scheduled Pinned Locked Moved COM
tutorialcsharpc++comsysadmin
3 Posts 3 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.
  • T Offline
    T Offline
    Thomas_Mathews
    wrote on last edited by
    #1

    How To pass structure or complex data in IDispatch using invoke() method. The COM server component is third party's so I donot have control on what defined in IDL or whatever technology they used. for example I want to pass complex data or structure like below to invoke() method. struct tag{ int i[10]; char str[40]; }sample; Below is sample code to access method passing argument. // Code omitted for brevity. szMember = “On”; dispparams.rgvarg[0].vt = VT_BOOL; dispparams.rgvarg[0].bool = FALSE; dispparams.rgdispidNamedArgs = &mydispid; dispparams.cArgs = 1; dispparams.cNamedArgs = 1; hresult = GetIDsOfNames(IID_NULL, &szMember, 1, LOCALE_USER_DEFAULT, &dispid); hresult = pdisp->Invoke( dispid, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_PROPERTYPUT, &dispparams, NULL, NULL, NULL); I need to pass one argument in IDispatch's Invoke method as below . This is sample code from c# client. I already have client C# code working. I want to pass structure which has byte array and string etc in c++ using IDispatch. How usually people pass structure as single argument in IDispatch's Invoke method() public class BLOB { /// <remarks/> public string contentType; public System.Byte[] binaryData; public string ID; public string URL; } OR If above is complex is anyone know how to pass structure like below in IDispatch's Invoke() method. The COM Server is third party. struct tag{ char str[100]; void *p; char str1[300]; }

    modified on Tuesday, January 20, 2009 2:23 AM

    J G 2 Replies Last reply
    0
    • T Thomas_Mathews

      How To pass structure or complex data in IDispatch using invoke() method. The COM server component is third party's so I donot have control on what defined in IDL or whatever technology they used. for example I want to pass complex data or structure like below to invoke() method. struct tag{ int i[10]; char str[40]; }sample; Below is sample code to access method passing argument. // Code omitted for brevity. szMember = “On”; dispparams.rgvarg[0].vt = VT_BOOL; dispparams.rgvarg[0].bool = FALSE; dispparams.rgdispidNamedArgs = &mydispid; dispparams.cArgs = 1; dispparams.cNamedArgs = 1; hresult = GetIDsOfNames(IID_NULL, &szMember, 1, LOCALE_USER_DEFAULT, &dispid); hresult = pdisp->Invoke( dispid, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_PROPERTYPUT, &dispparams, NULL, NULL, NULL); I need to pass one argument in IDispatch's Invoke method as below . This is sample code from c# client. I already have client C# code working. I want to pass structure which has byte array and string etc in c++ using IDispatch. How usually people pass structure as single argument in IDispatch's Invoke method() public class BLOB { /// <remarks/> public string contentType; public System.Byte[] binaryData; public string ID; public string URL; } OR If above is complex is anyone know how to pass structure like below in IDispatch's Invoke() method. The COM Server is third party. struct tag{ char str[100]; void *p; char str1[300]; }

      modified on Tuesday, January 20, 2009 2:23 AM

      J Offline
      J Offline
      Jonathan Davies
      wrote on last edited by
      #2

      How usually people pass structure as single argument in IDispatch's Invoke method? Personally I'd go for a VARIANT containing a SAFEARRARRAY which in turn contained the structure. Though your structure doesn't look to COM friendly, especially the void pointer. Have a look at this http://www.microsoft.com/msj/0696/activex0696.aspx[^]

      1 Reply Last reply
      0
      • T Thomas_Mathews

        How To pass structure or complex data in IDispatch using invoke() method. The COM server component is third party's so I donot have control on what defined in IDL or whatever technology they used. for example I want to pass complex data or structure like below to invoke() method. struct tag{ int i[10]; char str[40]; }sample; Below is sample code to access method passing argument. // Code omitted for brevity. szMember = “On”; dispparams.rgvarg[0].vt = VT_BOOL; dispparams.rgvarg[0].bool = FALSE; dispparams.rgdispidNamedArgs = &mydispid; dispparams.cArgs = 1; dispparams.cNamedArgs = 1; hresult = GetIDsOfNames(IID_NULL, &szMember, 1, LOCALE_USER_DEFAULT, &dispid); hresult = pdisp->Invoke( dispid, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_PROPERTYPUT, &dispparams, NULL, NULL, NULL); I need to pass one argument in IDispatch's Invoke method as below . This is sample code from c# client. I already have client C# code working. I want to pass structure which has byte array and string etc in c++ using IDispatch. How usually people pass structure as single argument in IDispatch's Invoke method() public class BLOB { /// <remarks/> public string contentType; public System.Byte[] binaryData; public string ID; public string URL; } OR If above is complex is anyone know how to pass structure like below in IDispatch's Invoke() method. The COM Server is third party. struct tag{ char str[100]; void *p; char str1[300]; }

        modified on Tuesday, January 20, 2009 2:23 AM

        G Offline
        G Offline
        guestcat
        wrote on last edited by
        #3

        Hi, Can you please provide the method signature that you want to access? you cannot send the structure just like that to a method in COM. Only you can pass the arguments that are agreed in the IDL of the COM server. you can find the signature using the OLE VIEWER.

        ^-^ @|@ - redCat

        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