safearray

How to build a SAFEARRAY of pointers to VARIANTs?

戏子无情 提交于 2019-12-03 07:47:02
I'm trying to use a COM component with the following method: HRESULT _stdcall Run( [in] SAFEARRAY(BSTR) paramNames, [in] SAFEARRAY(VARIANT *) paramValues ); How can I create in C/C++ the paramValues array? Adding to the answers above for reference by future readers: In IDL, SAFEARRAY(...) means a pointer to an array descriptor. But in C++, SAFEARRAY means an array descriptor. So IDL's SAFEARRAY(...) is really C++'s SAFEARRAY * . This confused me to no end. To make things even more interesting, VB always passes arrays by reference. So VB's () As Long is SAFEARRAY<int32_t> ** in C++. (I don't

Convert/cast SAFEARRAY of IUnknowns to an iterable array of interface pointers

拈花ヽ惹草 提交于 2019-12-02 04:01:52
问题 I have the following interface in C# with a class with a same name (without I) implementing it. [ComVisible(true)] [Guid("B2B134CC-70A6-43CD-9E1E-B3A3D9992C3E")] public interface IOrder { long GetQuantity(); long GetOrderType(); long GetPositionType(); } The implementation of the public class Order : IOrder is just three private fields and a constructor with required 3 parameters. Somewhere else, I have the following method with a result with which I want to work inside a C++ unmanaged code,

How to create a SAFEARRAY in Windows JScript?

ぃ、小莉子 提交于 2019-12-01 07:03:19
I want to create a SAFEARRAY of type byte in Windows JScript. Can you give me some example code or point me in the right direction? Hacky but stripting.dictionary::items is returned as a safe array so in some circumstances (ADSI queries) the following works, however YMMV significantly in trying this with binary data. function getSafeArray(jsArr) { var dict = new ActiveXObject("Scripting.Dictionary"); for (var i = 0; i < jsArr.length; i++) dict.add(i, jsArr[i]); return dict.Items(); } //to a safe array var safearr = getSafeArray([11,22,33]); //back to a js array var jsArr = new VBArray(safearr)

How to iterate through SAFEARRAY **

六眼飞鱼酱① 提交于 2019-12-01 03:16:21
how to iterate through C++ safearray pointer to pointer and access its elements. I tried to replicate the solution posted by Lim Bio Liong http://social.msdn.microsoft.com/Forums/en-US/vcgeneral/thread/022dba14-9abf-4872-9f43-f4fc05bd2602 but the strangest thing is that the IDL method signature comes out to be HRESULT __stdcall GetTestStructArray([out] SAFEARRAY ** test_struct_array); instead of HRESULT __stdcall GetTestStructArray([out] SAFEARRAY(TestStruct)* test_struct_array); Any ideas? thanks in advance Safearrays are created with SafeArrayCreate or SafeArrayCreateVector , but as you ask

How to pass SAFEARRAY to COM object through IDispatch?

耗尽温柔 提交于 2019-11-29 04:33:22
i am trying to call a method of COM object, where one of the documented parameters is an "array of bytes ". The actual declartion depends on the per-language documentation you're looking at: in C# language: byte[] TransformFinalBlock( byte[] inputBuffer, int inputOffset, int inputCount ) in C++ language; array<unsigned char>^ TransformFinalBlock( array<unsigned char>^ inputBuffer, int inputOffset, int inputCount ) in VB language: Function TransformFinalBlock ( _ inputBuffer As Byte(), _ inputOffset As Integer, _ inputCount As Integer _ ) As Byte() in F# language: abstract TransformFinalBlock :

How to pass SAFEARRAY to COM object through IDispatch?

二次信任 提交于 2019-11-27 18:36:28
问题 i am trying to call a method of COM object, where one of the documented parameters is an "array of bytes ". The actual declartion depends on the per-language documentation you're looking at: in C# language: byte[] TransformFinalBlock( byte[] inputBuffer, int inputOffset, int inputCount ) in C++ language; array<unsigned char>^ TransformFinalBlock( array<unsigned char>^ inputBuffer, int inputOffset, int inputCount ) in VB language: Function TransformFinalBlock ( _ inputBuffer As Byte(), _

How to create and initialize SAFEARRAY of doubles in C++ to pass to C#

雨燕双飞 提交于 2019-11-27 13:11:46
问题 My C# method needs to be invoked from C++ Originally my C# method takes a parameter of type double[], but when calling from C++ it becomes a SAFEARRAY In C++ I need to take data from an array of doubles, and populate a SAFEARRAY. I have not found any sample code to do this. Any help is appreciated 回答1: Following is the code to create a safearray in C++. #include<oaidl.h> void CreateSafeArray(SAFEARRAY** saData) { double data[10]; // some sample data to write into the created safearray