如何让动态链接库文件起作用

2025-05-30 06:27:15
推荐回答(1个)
回答1:

对于那些可以自行注册的对象链接和嵌入 (OLE) 控件(例如动态链接库 (DLL) 文件或 ActiveX 控件 (OCX) 文件),您可以使用 Regsvr32 工具 (Regsvr32.exe) 来将它们注册和取消注册。这对于解决 Windows、Microsoft Internet Explorer 或其他程序的某些问题可能是必要的。例如,以下 Microsoft 知识库文章要求您在从 Windows Update 网站重新安装 Wuv3is.dll 控件之前,首先使用 Regsvr32.exe 将该控件取消注册: 241122 ( http://support.microsoft.com/kb/241122/) WINUP:单击产品更新时出现应用程序错误如果控件注册失败,或者您需要了解有关解决 OLE 控件注册失败问题的开发人员信息,请参阅以下 Microsoft 知识库文章: 140346 ( http://support.microsoft.com/kb/140346/) OLE 控件注册失败的可能原因Regsvr32.exe 的用法RegSvr32.exe 具有以下命令行选项: Regsvr32 [/u] [/n] [/i[:cmdline]] dllname /u - Unregister server
/i - Call DllInstall passing it an optional [cmdline]; when used with /u calls dll uninstall /n - do not call DllRegisterServer; this option must be used with /i当您使用 Regsvr32.exe 时,它会尝试加载该组件并调用它的 DLLSelfRegister 函数。如果此尝试成功,Regsvr32.exe 会显示一个提示成功的对话框。如果此尝试失败,Regsvr32.exe 会返回一条错误信息,其中可能会包括一个 Win32 错误代码。要获得 Win32 错误代码的列表,请访问下面的 Microsoft 网站: http://www.microsoft.com/technet/treeview/default.asp?url=/technet/support/eventserrors.asp ( http://www.microsoft.com/technet/treeview/default.asp?url=/technet/support/eventserrors.asp)例如,要手动注册 Sample.ocx ActiveX 控件,请在 MS-DOS 提示符处键入以下命令: c:\regsvr32.exe sample.ocx