GetInterfacesForObject() public method

Get list of supported interfaces for a COM wrapper
public GetInterfacesForObject ( object obj ) : COMInterfaceEntry[]
obj object COM Wrapper Object
return COMInterfaceEntry[]
示例#1
0
        private void menuROTBindToObject_Click(object sender, EventArgs e)
        {
            if (listViewROT.SelectedItems.Count != 0)
            {
                MonikerInfo info = (MonikerInfo)(listViewROT.SelectedItems[0].Tag);

                Dictionary <string, string> props = new Dictionary <string, string>();
                props.Add("Display Name", info.strDisplayName);
                props.Add("CLSID", info.clsid.FormatGuid());

                try
                {
                    IBindCtx bindCtx = COMUtilities.CreateBindCtx(0);
                    Guid     unk     = COMInterfaceEntry.IID_IUnknown;
                    object   comObj;
                    Type     dispType;

                    info.moniker.BindToObject(bindCtx, null, ref unk, out comObj);
                    dispType = COMUtilities.GetDispatchTypeInfo(this, comObj);
                    ObjectInformation view = new ObjectInformation(m_registry, null, info.strDisplayName,
                                                                   comObj, props, m_registry.GetInterfacesForObject(comObj));
                    Program.GetMainForm(m_registry).HostControl(view);
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
示例#2
0
        private async void OpenObjectInformation(object comObj, string defaultName)
        {
            if (comObj != null)
            {
                Dictionary <string, string> props = new Dictionary <string, string>();
                string strObjName = "";
                IEnumerable <COMInterfaceEntry> ints = null;
                Guid clsid = COMUtilities.GetObjectClass(comObj);

                if (m_registry.Clsids.ContainsKey(clsid))
                {
                    COMCLSIDEntry ent = m_registry.Clsids[clsid];
                    strObjName = ent.Name;
                    props.Add("CLSID", ent.Clsid.ToString("B"));
                    props.Add("Name", ent.Name);
                    props.Add("Server", ent.Server);
                    await ent.LoadSupportedInterfacesAsync(false);

                    ints = ent.Interfaces.Select(i => m_registry.MapIidToInterface(i.Iid));
                }
                else
                {
                    ints       = m_registry.GetInterfacesForObject(comObj);
                    strObjName = defaultName != null ? defaultName : clsid.ToString("B");
                    props.Add("CLSID", clsid.ToString("B"));
                }

                Type dispType = COMUtilities.GetDispatchTypeInfo(comObj);
                HostControl(new ObjectInformation(m_registry, strObjName, comObj, props, ints.ToArray()));
            }
        }
示例#3
0
        private COMInterfaceEntry[] GetInterfaces()
        {
            if (_interfaces == null)
            {
                _interfaces = _registry.GetInterfacesForObject(_target);
            }

            return(_interfaces);
        }
示例#4
0
        private COMInterfaceEntry[] GetInterfaces()
        {
            if (_interfaces == null)
            {
                _interfaces = _registry.GetInterfacesForObject(_target).OrderBy(i => i.Name).ToArray();
            }

            return(_interfaces);
        }
示例#5
0
 private void btnCreate_Click(object sender, EventArgs e)
 {
     try
     {
         IClassFactory factory = (IClassFactory)m_pObject;
         object        new_object;
         Guid          IID_IUnknown        = COMInterfaceEntry.IID_IUnknown;
         Dictionary <string, string> props = new Dictionary <string, string>();
         props.Add("Name", m_objName);
         factory.CreateInstance(null, ref IID_IUnknown, out new_object);
         ObjectInformation view = new ObjectInformation(m_registry, m_objName, new_object,
                                                        props, m_registry.GetInterfacesForObject(new_object));
         Program.GetMainForm().HostControl(view);
     }
     catch (Exception ex)
     {
         MessageBox.Show(this, ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
示例#6
0
 private void btnCreate_Click(object sender, EventArgs e)
 {
     try
     {
         IElevatedFactoryServer factory = (IElevatedFactoryServer)_obj;
         COMCLSIDEntry          vso     = comboBoxClass.SelectedItem as COMCLSIDEntry;
         if (vso != null)
         {
             object new_object;
             Dictionary <string, string> props = new Dictionary <string, string>();
             props.Add("Name", _name);
             props.Add("CLSID", vso.Clsid.FormatGuid());
             factory.ServerCreateElevatedObject(vso.Clsid, COMInterfaceEntry.IID_IUnknown, out new_object);
             ObjectInformation view = new ObjectInformation(_registry, vso,
                                                            vso.Name, new_object,
                                                            props, _registry.GetInterfacesForObject(new_object));
             Program.GetMainForm(_registry).HostControl(view);
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(this, ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
示例#7
0
 public ObjectEntry(COMRegistry registry, string name, object instance)
     : this(registry, name, instance, registry.GetInterfacesForObject(instance).OrderBy(i => i.Name).ToArray())
 {
 }
 public ObjectEntry(COMRegistry registry, string name, object instance)
     : this(registry, name, instance, registry.GetInterfacesForObject(instance))
 {
 }
示例#9
0
 public ObjectEntry(COMRegistry registry, string name, object instance)
     : this(registry, name, instance, registry.GetInterfacesForObject(instance))
 {
 }