GetInterfacesForObject() public méthode

Get list of supported interfaces for a COM wrapper
public GetInterfacesForObject ( object obj ) : COMInterfaceEntry[]
obj object COM Wrapper Object
Résultat COMInterfaceEntry[]
Exemple #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);
                }
            }
        }
Exemple #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()));
            }
        }
Exemple #3
0
        private COMInterfaceEntry[] GetInterfaces()
        {
            if (_interfaces == null)
            {
                _interfaces = _registry.GetInterfacesForObject(_target);
            }

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

            return(_interfaces);
        }
Exemple #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);
     }
 }
Exemple #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);
     }
 }
 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))
 {
 }
Exemple #9
0
 public ObjectEntry(COMRegistry registry, string name, object instance)
     : this(registry, name, instance, registry.GetInterfacesForObject(instance))
 {
 }