1

如何在运行时检查 dll 是否已正确注册?目前正在尝试以下操作,但即使它已使用regsvr32. Assembly 类是否仅适用于系统程序集,如果可以,我自己的程序集使用什么?

    'check com dll connection for diagnostics
    Try
        Dim asm As Assembly = Assembly.LoadWithPartialName("mycomdll.mycomclass")
        DebugText.AppendText("DLL registered" + vbNewLine)
    Catch ex As Exception
        DebugText.AppendText("DLL test failed" + vbNewLine)
        DebugText.AppendText(ex.ToString() + vbNewLine)
    End Try
4

1 回答 1

1
    'check com dll connection for diagnostics
    Try
        Dim test As Object = CreateObject("mycomdll.mycomclass")
        test.mymethod(0)
        DebugText.AppendText("COM DLL registered" + vbNewLine)
    Catch ex As Exception
        DebugText.AppendText("COM test failed" + vbNewLine)
        DebugText.AppendText(ex.ToString() + vbNewLine + vbNewLine)
    End Try
于 2013-04-03T15:35:57.190 回答