ActiveX 组件无法创建对象
我刚刚在 Windows Server 2008 服务器上安装了第三方应用程序 我得到了
ActiveX 组件无法创建对象
当我尝试在 VBScript 中使用 CreateObject
进行访问时,
消息。 它肯定已安装并存在于“程序和功能”下。 有谁有我可以检查以弄清楚发生了什么事情的清单吗?
我现在尝试按照建议使用 regsvr32.exe /i bob.dll 注册 DLL,但收到此错误:
模块“Bob.dll”已加载,但入口点 DllRegisterServer 已加载 未找到。
确保“Bob.dll”是有效的 DLL 或 OCX 文件,然后重试。
我应该指出,这是 64 位机器上的 32 位应用程序 这点。 它在我的 Windows XP 32 位机器上也运行良好。
I have just installed a third party app on my Windows Server 2008 server
and I get the
ActiveX Component can't create object
message when I try to access using a CreateObject
in VBScript.
It is definitely installed and exists under "Programs and Features". Does anyone have a list of things that I can check to figure out what is going on?
I have now tried to register the DLL using regsvr32.exe /i bob.dll
as suggested but I get this error:
The Module "Bob.dll" was loaded but the entry-point DllRegisterServer was
not found.Make sure that "Bob.dll" is valid DLL or OCX file and then try again.
I should note that this is a 32-bit application on a 64-bit machine at
this point. It also works fine on my machine which is Windows XP 32-bit.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(12)
事实证明,为了让这个应用程序在 VBScript 下运行,我必须做两件事。
如果这些方法不起作用,请查看此处有关在 IIS 中启用 32 位应用程序的其他答案。
It turns out to get this application working under VBScript, I had to do two things.
If these don't work, check out the other answer here about enabling 32-bit applications in IIS.
还值得检查的是,您是否已在 IIS 内 DefaultAppPool 的高级设置中将“启用 32 位应用程序”设置为 True。
It's also worth checking that you've got "Enable 32-bit Applications" set to True in the advanced settings of the DefaultAppPool within IIS.
应用程序正在尝试创建 COM 对象,即使该 COM DLL 存在,它也可能依赖于另一个未安装的 DLL。 您可以使用 DependencyWalker 来查明是否属于这种情况。
The app is trying to create a COM Object and even if that COM DLL exists, it may depend on another DLL which isn't installed. You can use DependencyWalker to find out if this is the case.
检查您的浏览器设置。
对于我来说,使用 IE,修复方法是进入“工具/Internet 选项”、“安全”选项卡,找到相关区域、“自定义级别”并检查 ActiveX 设置。 将“初始化和脚本未标记为安全脚本的 ActiveX 控件”设置为“启用”为我解决了这个问题。
Check your browser settings.
For me, using IE, the fix was to go into Tools/Internet Options, Security tab, for the relevant zone, "custom level" and check the ActiveX settings. Setting "Initialize and script ActiveX controls not marked as safe for scripting" to "Enable" fixed this problem for me.
另外,当您注册组件时,请确保使用 regsvr32.exe 的 32 位版本。
如果您只是在提升的提示符下运行 regsvr32.exe,它将默认采用标准 64 位版本(奇怪的是位于 C:\Windows\System32),
我相信您需要的版本位于 C:\Windows\ SysWow64\regsvr32.exe
Also when you register the component make sure you use the 32-bit version of regsvr32.exe.
If you simply run regsvr32.exe in a elevated prompt, it will default take the standard 64-bit version (which oddly enough is located in C:\Windows\System32)
The version I believe you need is located in C:\Windows\SysWow64\regsvr32.exe
看起来您引用的对象确实没有在系统上注册。 我知道你说它已安装,但这并不一定意味着它已注册。 要确认这一点,请搜索您在注册表中使用的 progID。
此代码的示例:
我将在注册表中搜索 Scripting.FileSystemObject 。 然后我会查看找到的值上方的注册表项,以获取
InProcServer32
值。 这将为您提供注册 ActiveX 文件的路径(对于 Scripting.FileSystemObject,该文件为“c:\windows\system32\scrrun.dll”)。如果您在注册表中找不到您的 progID,那么它没有在您的系统上注册,这就是您的问题。 如果未注册,您需要找出哪个文件注册了它,通常是第三方应用程序同一文件夹路径中的 .ocx 或 .dll,然后注册这些文件。 以下是注册文件的命令:
即使您在注册表中找到了 progID 值并且它引用了系统上存在的文件,您可能仍然想尝试重新注册该文件。 我发现有时注册会在某个地方被破坏,重新注册文件比解决问题更容易。
It really looks as though the object you are referencing is not registered on the system. I know you said it's installed, but that doesn't necessarily mean it's registered. To confirm this, search for the progID that you used in your registry.
Example for this code:
I would search for
Scripting.FileSystemObject
in the registry. Then I would look at registry key above the found value, forInProcServer32
value. This will give you the path to the ActiveX file that it was registered from (forScripting.FileSystemObject
the file is "c:\windows\system32\scrrun.dll").If you can't find your progID in the registry, then it's not registered on your system which is your problem. If it's not registered you need to find out what file registers it, which is usually an .ocx or a .dll in the same folder path of your third party app, and then register these file(s). Here is the command to register a file:
Even if you find the progID value in the registry and it references a file that is present on your system, you may still want to try re-registering the file. I have found that sometimes the registration got broken somehow somewhere and it was easier to re-register the files then it was to fix the issue.
如果是 32 位 COM/Active X,请使用位于 C:\Windows\SysWOW64\ 的 32 位 cscript.exe/wscript.exe 版本
If its a 32 bit COM/Active X, use version 32 bit of cscript.exe/wscript.exe located in C:\Windows\SysWOW64\
我知道这是一个旧线程,但是有人检查过他们的防病毒软件是否阻止了他们系统上的 Win32API 和脚本吗? 我在我的办公系统上安装了 CylanceProtect,我发现出现了与其他人列出的相同的问题。 如果您在事件查看器中检查 Windows 日志,则可以确认这一点。
I know this is an old thread, but has anyone checked if their Antivirus is blocking Win32API and Scripting on their systems? I have CylanceProtect installed on my office system and i found the same issues occurring as listed by others. This can be confirmed if you check the Windows Logs in Event Viewer.
我在 vbscript 中也遇到了同样的错误。
解决方案:
打开命令行,运行:
就可以了
I also meet the same error in vbscript.
Solution:
Open command line, run :
and it works
我在编写的 VB6 程序中遇到了同样的问题,其中 Form 使用 ScriptControl 对象来运行用户选择的 VBScript。
它工作得很好,直到有一天,当 VBScript 尝试创建 Scripting.FileSystemObject 时,它突然开始显示“运行时错误 429”。
在疯狂了一整天并尝试了这里提出的所有解决方案之后,我开始怀疑问题出在我的应用程序中。
幸运的是,我有该形式的备份版本:我比较了它们的代码,发现我无意中将 ScriptControl 对象的 UseSafeSubset 属性设置为 True。
这是形式上的唯一区别,在恢复备份副本后,它就像一个魅力。
希望这对某人有用。 升级VB6! :-)
马克斯 - 意大利
I've had the same issue in a VB6 program I'm writing, where a Form uses a ScriptControl object to run VBScripts selected by the User.
It worked fine until the other day, when it suddenly started displaying 'Runtime error 429' when the VBScript attempted to create a Scripting.FileSystemObject.
After going mad for an entire day, trying all the solutions proposed here, I began suspecting the problem was in my application.
Fortunately, I had a backup version of that form: I compared their codes, and discovered that inadvertently I had set UseSafeSubset property of my ScriptControl object to True.
It was the only difference in the form, and after restoring the backup copy it worked like a charm.
Hope this can be useful to someone. Up with VB6! :-)
Max - Italy
我在使用 Excel 时遇到了同样的问题,我尝试将 32 COM DLL 与 Excel 64 位版本一起使用,但出现此错误。 我将 COM dll 重建为 64 位版本,错误消失了。 因此,请确保您的 COM dll 与您的应用程序具有相同的体系结构(x86 与 x64)。
I had the same issue with Excel, I was trying to use a 32 COM DLL with an Excel 64 bits version and I got this error. I rebuild the COM dll to a 64 bits version and the error disappears. So be sure that your COM dll has the same architecture (x86 vs x64) than your application.
我也有这个问题。 我试图在 64 位系统中运行旧的 32 位 dll。 我通过将 .dll 复制到 C:\Windows\SysWoW64\ 目录并运行以下命令来使其工作:
并且还启用 IIS 运行 32位应用程序
I had this problem too. I was trying to run an old 32-bit dll in a 64 bit system. I got it working by copying the .dll to the C:\Windows\SysWoW64\ directory and running this:
And also enabling IIS to run 32 bit apps