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. 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
-
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
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[^]
-
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
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