OleViewDotNet.COMRegistry.GetInterfacesForObject C# (CSharp) Method

GetInterfacesForObject() public method

Get list of supported interfaces for a COM wrapper
public GetInterfacesForObject ( object obj ) : COMInterfaceEntry[]
obj object COM Wrapper Object
return COMInterfaceEntry[]
        public COMInterfaceEntry[] GetInterfacesForObject(object obj)
        {
            COMInterfaceEntry[] ret;

            IntPtr pObject = Marshal.GetIUnknownForObject(obj);
            ret = GetInterfacesForIUnknown(pObject).ToArray();
            Marshal.Release(pObject);

            return ret;
        }

Usage Example

Ejemplo n.º 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);
                }
            }
        }
All Usage Examples Of OleViewDotNet.COMRegistry::GetInterfacesForObject