예제 #1
0
        public ComPtrTreeNode(string caption, ComPtr comPtr)
            : base(caption)
        {
            if (comPtr != null)
            {
                _comPtr = comPtr;

                if (_comPtr.IsInvalid == false)
                {
                    ComTypeInfo comTypeInfo = _comPtr.TryGetComTypeInfo();
                    if (comTypeInfo != null)
                    {
                        TypeFullName = comTypeInfo.FullName;
                    }
                    else
                    {
                        TypeFullName = "IUnknown";
                    }

                    _isCollection = _comPtr.TryIsCollection();

                    if (_isCollection)
                    {
                        _collectionCount = _comPtr.TryGetItemCount();
                    }

                    string[] propertyNames = { "Name", "Caption", "StyleName", "ID", "Count", "Environment", "Description", "CommandString" };
                    var      value         = comPtr.TryGetFirstAvailableProperty(propertyNames);

                    if (value != null)
                    {
                        Value = value.ToString();
                    }
                }
            }
        }
예제 #2
0
        public ComPtrTreeNode(string caption, ComPtr comPtr)
            : base(caption)
        {
            if (comPtr != null)
            {
                _comPtr = comPtr;

                if (_comPtr.IsInvalid == false)
                {
                    ComTypeInfo comTypeInfo = _comPtr.TryGetComTypeInfo();
                    if (comTypeInfo != null)
                    {
                        TypeFullName = comTypeInfo.FullName;
                    }
                    else
                    {
                        TypeFullName = "IUnknown";
                    }

                    _isCollection = _comPtr.TryIsCollection();

                    if (_isCollection)
                    {
                        _collectionCount = _comPtr.TryGetItemCount();
                    }

                    string[] propertyNames = { "Name", "Caption", "StyleName", "ID", "Count", "Environment", "Description", "CommandString" };
                    var value = comPtr.TryGetFirstAvailableProperty(propertyNames);

                    if (value != null)
                    {
                        Value = value.ToString();
                    }
                }
            }
        }