Пример #1
0
        private void viewTypeLibraryToolStripMenuItem_Click(object sender, EventArgs e)
        {
            TreeNode node = treeComRegistry.SelectedNode;

            if (node != null)
            {
                COMTypeLibVersionEntry ent = node.Tag as COMTypeLibVersionEntry;

                if (ent == null)
                {
                    COMCLSIDEntry  clsid  = node.Tag as COMCLSIDEntry;
                    COMProgIDEntry progid = node.Tag as COMProgIDEntry;
                    if (progid != null)
                    {
                        clsid = m_reg.MapClsidToEntry(progid.Clsid);
                    }

                    if (clsid != null && m_reg.Typelibs.ContainsKey(clsid.TypeLib))
                    {
                        ent = m_reg.Typelibs[clsid.TypeLib].Versions.First();
                    }
                }

                if (ent != null)
                {
                    try
                    {
                        Assembly typeLibary = COMUtilities.LoadTypeLib(ent.NativePath);

                        TypeLibControl view = new TypeLibControl(ent, typeLibary);
                        Program.GetMainForm().HostControl(view);
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
            }
        }
Пример #2
0
        private void viewTypeLibraryToolStripMenuItem_Click(object sender, EventArgs e)
        {
            TreeNode node = treeComRegistry.SelectedNode;

            if (node != null)
            {
                COMTypeLibVersionEntry ent = node.Tag as COMTypeLibVersionEntry;

                if (ent == null)
                {
                    COMCLSIDEntry clsid = node.Tag as COMCLSIDEntry;
                    COMProgIDEntry progid = node.Tag as COMProgIDEntry;
                    if(progid != null)
                    {
                        clsid = m_reg.MapClsidToEntry(progid.Clsid);
                    }

                    if(clsid != null && m_reg.Typelibs.ContainsKey(clsid.TypeLib))
                    {
                        ent = m_reg.Typelibs[clsid.TypeLib].Versions.First();
                    }
                }
                
                if(ent != null)
                {
                    try
                    {
                        Assembly typeLibary = COMUtilities.LoadTypeLib(ent.NativePath);
                       
                        TypeLibControl view = new TypeLibControl(ent, typeLibary);
                        Program.GetMainForm().HostControl(view);
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
            }
        }