Esempio n. 1
0
        private void AddMemberVariables(SortedList members, int count)
        {
            for (int index = 0; index < count; ++index)
            {
                IntPtr varptr = IntPtr.Zero;
                m_typeInfo.ComType.GetVarDesc(index, out varptr);
                Win32.VARDESC varDesc = (Win32.VARDESC)Marshal.PtrToStructure(varptr, typeof(Win32.VARDESC));

                try
                {
                    MemberDesc desc = new FieldDesc(m_typeInfo.ComType, varDesc);
                    members.Add(new ComMemberBrowserInfo(this, desc, desc.Name), desc.Name);
                }
                finally
                {
                    m_typeInfo.ComType.ReleaseVarDesc(varptr);
                }
            }
        }
Esempio n. 2
0
        public FieldDesc(ITypeInfo typeInfo, Win32.VARDESC varDesc)
        {
            string name;
            string docString;
            int    helpContext;
            string helpFile;

            typeInfo.GetDocumentation(varDesc.memid, out name, out docString, out helpContext, out helpFile);

            Initialise(MemberTypes.Field, name);

            m_type = GetComType(typeInfo, varDesc.elemdescVar.tdesc);

            if (varDesc.varkind == Win32.VARKIND.VAR_CONST)
            {
                object fieldValue = Marshal.GetObjectForNativeVariant(varDesc.descUnion.lpvarValue);
                Debug.Assert(fieldValue != null, "fieldValue != null");
                m_value = fieldValue.ToString();
            }
            else
            {
                m_value = null;
            }
        }