Exemple #1
0
        public void CallAsProcedure(int methodNumber, IValue[] arguments)
        {
            int paramCount = NativeApiProxy.GetNParams(_object, methodNumber);

            using (var variant = new NativeApiVariant(paramCount))
            {
                SetDefValues(methodNumber, paramCount, arguments);
                for (int i = 0; i < paramCount; i++)
                {
                    variant.Assign(arguments[i], i);
                }

                NativeApiProxy.CallAsProc(_object, methodNumber, variant.Ptr);
            }
        }
        public void CallAsProcedure(int methodNumber, IValue[] arguments)
        {
            var paramArray = IntPtr.Zero;
            int paramCount = NativeApiProxy.GetNParams(_object, methodNumber);

            if (paramCount > 0)
            {
                paramArray = Marshal.AllocHGlobal(NativeApiVariant.Size * paramCount);
            }
            SetDefValues(methodNumber, paramCount, arguments);
            NativeApiVariant.SetValue(paramArray, arguments, paramCount);
            NativeApiProxy.CallAsProc(_object, methodNumber, paramArray);
            NativeApiVariant.GetValue(arguments, paramArray, paramCount);
            NativeApiVariant.Clear(paramArray, paramCount);
            Marshal.FreeHGlobal(paramArray);
        }