You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

VB.NET应用使用VLC插件触发“类未注册”错误求助

解决VB.NET调用VLC插件时的REGDB_E_CLASSNOTREG错误

我来帮你搞定这个问题!你遇到的Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG))错误,本质是目标电脑上VLC的COM组件没被系统识别——毕竟格式化后没做必要配置,而开发机因为之前装过VLC并注册了组件,所以能正常运行。

错误详情确认

先把你遇到的完整错误栈贴出来方便参考:

See the end of this message for details on invoking just-in-time (JIT) debugging instead of this dialog box.
************** Exception Text **************
System.InvalidOperationException: An error occurred creating the form. See Exception.InnerException for details. The error is: Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)) ---> System.Runtime.InteropServices.COMException (0x80040154): Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG))
at System.Windows.Forms.UnsafeNativeMethods.CoCreateInstance(Guid& clsid, Object punkOuter, Int32 context, Guid& iid)
at System.Windows.Forms.AxHost.CreateWithoutLicense(Guid clsid)
at System.Windows.Forms.AxHost.CreateWithLicense(String license, Guid clsid)
at System.Windows.Forms.AxHost.CreateInstanceCore(Guid clsid)
at System.Windows.Forms.AxHost.CreateInstance()
at System.Windows.Forms.AxHost.GetOcxCreate()
at System.Windows.Forms.AxHost.TransitionUpTo(Int32 state)
at System.Windows.Forms.AxHost.CreateHandle()
at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
at System.Windows.Forms.AxHost.EndInit()
at sysQcf.FrmMediaPlayer2.InitializeComponent()
at sysQcf.FrmMediaPlayer2..ctor()
--- End of inner exception stack trace ---
at sysQcf.My.MyProject.MyForms.Create__Instance__[T](T Instance)
at sysQcf.My.MyProject.MyForms.get_FrmMediaPlayer2()
at sysQcf.FrmLogin.login(String username, String password)
at sysQcf.FrmLogin.TxtPassword_KeyDown(Object sender, KeyEventArgs e)
at System.Windows.Forms.Control.OnKeyDown(KeyEventArgs e)
at System.Windows.Forms.Control.ProcessKeyEventArgs(Message& m)
at System.Windows.Forms.Control.ProcessKeyMessage(Message& m)
at System.Windows.Forms.Control.WmKeyChar(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.TextBoxBase.WndProc(Message& m)
at System.Windows.Forms.TextBox.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
************** Loaded Assemblies **************
mscorlib Assembly Version: 2.0.0.0 Win32 Version: 2.0.50727.5420 (Win7SP1.050727-5400) CodeBase: file:///C:/Windows/Microsoft.NET/Framework/v2.0.50727/mscorlib.dll

sysQcf Assembly Version: 1.0.0.0 Win32 Version: 1.0.0.0 CodeBase: file:///D:/qcfupdated/debug/sysQcf.exe

Microsoft.VisualBasic Assembly Version: 8.0.0.0 Win32 Version: 8.0.50727.5420 (Win7SP1.050727-5400) CodeBase: file:///C:/Windows/assembly/GAC_MSIL/Microsoft.VisualBasic/8.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualBasic.dll

System Assembly Version: 2.0.0.0 Win32 Version: 2.0.50727.5420 (Win7SP1.050727-5400) CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll

System.Windows.Forms Assembly Version: 2.0.0.0 Win32 Version: 2.0.50727.5420 (Win7SP1.050727-5400) CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Windows.Forms/2.0.0.0__b77a5c561934e089/System.Windows.Forms.dll

...(省略剩余加载的程序集)

具体解决方案

1. 安装带ActiveX组件的VLC播放器

格式化后的电脑默认没有VLC的COM组件,你需要:

  • 下载和你程序平台位数匹配的VLC安装包(32位或64位)
  • 安装时务必勾选"ActiveX plugin and web plugin"选项(默认可能不勾选,这是关键!)
  • 安装完成后重启电脑,再运行你的应用

2. 手动注册VLC的COM组件(已装VLC但仍报错时)

如果已经安装了VLC但组件注册失败,可以手动操作:

  • 找到VLC安装目录:
    • 32位VLC:C:\Program Files (x86)\VideoLAN\VLC
    • 64位VLC:C:\Program Files\VideoLAN\VLC
  • 以管理员身份打开命令提示符:
    • 32位程序在64位系统上,用SysWOW64下的regsvr32:
      C:\Windows\SysWOW64\regsvr32.exe "C:\Program Files (x86)\VideoLAN\VLC\axvlc.dll"
      C:\Windows\SysWOW64\regsvr32.exe "C:\Program Files (x86)\VideoLAN\VLC\npvlc.dll"
      
    • 64位程序,用System32下的regsvr32:
      C:\Windows\System32\regsvr32.exe "C:\Program Files\VideoLAN\VLC\axvlc.dll"
      C:\Windows\System32\regsvr32.exe "C:\Program Files\VideoLAN\VLC\npvlc.dll"
      
  • 注册成功会弹出提示,之后再运行应用

3. 检查项目的平台目标设置

开发机可能默认匹配了VLC的平台,而目标电脑的系统位数导致不兼容:

  • 打开VB.NET项目,右键项目 → 属性 → 编译
  • 找到"平台目标"选项:
    • 装的是32位VLC,就选x86(别选Any CPU,64位系统会默认跑64位,找不到32位COM组件)
    • 装的是64位VLC,就选x64
  • 重新编译项目后再部署到目标电脑

4. 打包VLC组件到应用目录(可选,避免用户手动安装)

如果不想让用户自己装VLC,可以把VLC必要文件打包到应用目录:

  • 复制VLC安装目录下的axvlc.dll、npvlc.dll、libvlc.dll、libvlccore.dll以及整个plugins文件夹到你的应用目录
  • 应用启动时通过代码注册这些dll(需要管理员权限),或让用户手动注册
  • 注意:VLC是GPL开源软件,分发时需遵循其许可证条款

按照上面的步骤操作,应该就能解决这个注册错误了!

内容的提问来源于stack exchange,提问作者lexi

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.28 04:04:44