LoadTypeLib() public static method

public static LoadTypeLib ( string path ) : Assembly
path string
return System.Reflection.Assembly
コード例 #1
0
ファイル: MainForm.cs プロジェクト: Deeby/oleviewdotnet
 private void menuFileOpenTypeLib_Click(object sender, EventArgs e)
 {
     using (OpenFileDialog dlg = new OpenFileDialog())
     {
         dlg.Filter = "TLB Files (*.tlb)|*.tlb|Executable Files (*.exe;*.dll;*.ocx)|*.exe;*.dll;*.ocx|All Files (*.*)|*.*";
         if (dlg.ShowDialog(this) == DialogResult.OK)
         {
             Assembly typelib = COMUtilities.LoadTypeLib(this, dlg.FileName);
             if (typelib != null)
             {
                 HostControl(new TypeLibControl(Path.GetFileName(dlg.FileName), typelib, Guid.Empty, false));
             }
         }
     }
 }
コード例 #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);
                    }
                }
            }
        }