Esempio n. 1
0
        private void LoadMembers()
        {
            _members = new List <ComMemberInfo>();

            for (short i = 0; i < _typeAttr.cFuncs; i++)
            {
                IntPtr pFuncDesc = IntPtr.Zero;

                _typeInfo.GetFuncDesc(i, out pFuncDesc);
                ComFunctionInfo comFunctionInfo = new ComFunctionInfo(this, pFuncDesc);

                _members.Add(comFunctionInfo);
            }

            /* Note that these are not always enum constants.  Some properties show up as VARDESC's. */
            for (short i = 0; i < _typeAttr.cVars; i++)
            {
                System.Runtime.InteropServices.ComTypes.VARDESC varDesc;
                IntPtr p = IntPtr.Zero;

                _typeInfo.GetVarDesc(i, out p);
                object constantValue = null;

                try
                {
                    varDesc = p.ToStructure <System.Runtime.InteropServices.ComTypes.VARDESC>();

                    if (varDesc.varkind == VARKIND.VAR_CONST)
                    {
                        constantValue = Marshal.GetObjectForNativeVariant(varDesc.desc.lpvarValue);
                    }
                }
                finally
                {
                    _typeInfo.ReleaseVarDesc(p);
                }

                ComVariableInfo comVariableInfo = new ComVariableInfo(this, varDesc, constantValue);
                _members.Add(comVariableInfo);
            }

            _members.Sort(delegate(ComMemberInfo a, ComMemberInfo b)
            {
                return(a.Name.CompareTo(b.Name));
            });
        }
 public ComVariableInfoTreeNode(ComVariableInfo comVariableInfo)
     : base()
 {
     _comVariableInfo = comVariableInfo;
     Text = _comVariableInfo.Name;
     FullText = String.Format("{0}.{1}", _comVariableInfo.ComTypeInfo.FullName, _comVariableInfo.Name);
 }
        public void DescribeComVariableInfo(ComVariableInfo comVariableInfo)
        {
            try
            {
                Clear();

                if (comVariableInfo == null) return;

                AppendText("Constant ");
                AppendText(comVariableInfo.Name, ForeColor, FontStyle.Bold);
                AppendText(String.Format(" = {0}", comVariableInfo.ConstantValue));
                AppendText(Environment.NewLine);
                AppendText("   Member of ");
                InsertLink(comVariableInfo.ComTypeInfo.FullName);
                AppendText(Environment.NewLine);

                WriteSummary(comVariableInfo.Description);
            }
            catch
            {
            }
        }
Esempio n. 4
0
        private void LoadMembers()
        {
            _members = new List<ComMemberInfo>();

            for (short i = 0; i < _typeAttr.cFuncs; i++)
            {
                IntPtr pFuncDesc = IntPtr.Zero;

                _typeInfo.GetFuncDesc(i, out pFuncDesc);
                ComFunctionInfo comFunctionInfo = new ComFunctionInfo(this, pFuncDesc);

                _members.Add(comFunctionInfo);
            }

            /* Note that these are not always enum constants.  Some properties show up as VARDESC's. */
            for (short i = 0; i < _typeAttr.cVars; i++)
            {
                System.Runtime.InteropServices.ComTypes.VARDESC varDesc;
                IntPtr p = IntPtr.Zero;

                _typeInfo.GetVarDesc(i, out p);
                object constantValue = null;

                try
                {
                    varDesc = p.ToStructure<System.Runtime.InteropServices.ComTypes.VARDESC>();

                    if (varDesc.varkind == VARKIND.VAR_CONST)
                    {
                        constantValue = Marshal.GetObjectForNativeVariant(varDesc.desc.lpvarValue);
                    }
                }
                finally
                {
                    _typeInfo.ReleaseVarDesc(p);
                }

                ComVariableInfo comVariableInfo = new ComVariableInfo(this, varDesc, constantValue);
                _members.Add(comVariableInfo);
            }

            _members.Sort(delegate(ComMemberInfo a, ComMemberInfo b)
            {
                return a.Name.CompareTo(b.Name);
            });
        }