CoCreateInstance失败,返回错误码0x8007007e
来源:互联网 发布:生煎网络用语的意思 编辑:程序博客网 时间:2024/04/30 12:18
CoCreateInstance失败,返回错误码0x8007007e
Debug编译的COM接口好好的,但用Release编译后,用CoCreateInstance获得接口都失败。
Release编译的时候,把_ATL_STATIC_REGISTRY去掉就可以了。msdn上对_ATL_STATIC_REGISTRY的解释如下:
A symbol that indicates you want the registration code for your object to be in the object to avoid a dependency on ATL.DLL.
虽然问题解决了,但道理没想通。我同样用ATL写了个测试的COM组件,release编译选项里仍然有_ATL_STATIC_REGISTRY,测试结果是可以用的。
感觉很奇怪。希望有人能告知原因。
论坛的相关讨论:
10 楼sinall()回复于 2005-05-31 20:11:42 得分 0 搜了MSDN,找到一下:
1、
The specified module could not be found
(0x8007007e)
The specified OLE object is registered as an in-process OLE server (.DLL file), but the .DLL file could not be found or loaded.
2、
DECLARE_REGISTRY_RESOURCEID
DECLARE_REGISTRY_RESOURCEID( x )
Parameters
x
[in] Wizard-generated identifier of your resource.
Remarks
Same as DECLARE_REGISTRY_RESOURCE except that it uses a Wizard-generated UINT to identify the resource, rather than a string name.
When you create an object or control using the ATL Object Wizard, the wizard will automatically implement script-based registry support and add the DECLARE_REGISTRY_RESOURCEID macro to your files.
You can statically link with the ATL Registry Component (Registrar) for optimized registry access. To statically link to the Registrar code, add #define _ATL_STATIC_REGISTRY to your stdafx.h.
3、
Beginning with ATL 2.0, the DECLARE_STATIC_REGISTRY_RESOURCEID macro is obsolete. To statically link to the Registrar, you specify the #define _ATL_STATIC_REGISTRY statement in stdafx.h and use the DECLARE_REGISTRY_RESOURCEID macro.
4、
Add the following to end of stdafx.cpp:
#ifdef _ATL_STATIC_REGISTRY
#include <statreg.h>
#include <statreg.cpp>
#endif
#include <atlimpl.cpp>
NOTE: In the release build, if you do not want to statically link in the ATL registration, then include _ATL_DLL in the preprocessor symbols in the project settings dialog box.
结论如下:
1)、检查你的stdafx.cpp看是否同上面的4
2)、问题可能出在,控件的注册能力失败。检查一下注册表,看是否有相关注册信息,注册信息是否正确。
3)、“但道理没想通。我同样用ATL写了个测试的COM组件,release编译选项里仍然有_ATL_STATIC_REGISTRY,测试结果是可以用的”,要不程序重做一遍,看是否是因为写代码的过程中人为引入的错误。
11 楼wangbab(bab)回复于 2005-06-01 09:00:06 得分 0 多谢楼上的指点。
1、stdafx.cpp和你所说的是一样的。
2、搜了一下注册表。发现注册表里只有class的CLSID,接口的IID是没有的。应该是注册出现了问题。但也是可以使用的。请问是什么原因
3、写的测试控件应该没问题。因为测试控件Debug和Release下都可以用的。而且我2个控件都是由向导升成的。
感谢sinall(一颗红星,两手准备) ( ) 找到的资料。
12 楼sinall()回复于 2005-06-01 09:05:45 得分 80我找到的资料价值不大。^_^
2、是对的。IID是不会出现在注册表中的。
有没有对比一下Debug和Release注册表有没有区别。
我觉得还是把程序简单重做一遍,看看问题是偶然的还是必然的。
- CoCreateInstance失败,返回错误码0x8007007e
- 0x8007007E 错误解决方法
- 0x8007007E 错误解决
- 调用CoCreateInstance 函数 返回值-2147221008 错误
- dll 错误 异常来自 HRESULT:0x8007007E
- APNs连接失败,返回错误码为0
- GetFirmwareEnvironmentVariable失败返回错误码1314
- LoadLibray失败,返回错误码193
- RegisterNatives注册失败,返回错误码-1
- CoCreateInstance失败的一种解决方案
- 0x8007007E 错误解决 - darkjune - JavaEye技术网站
- IIS7.5 错误代码0x8007007e HTTP 错误 500.19
- IIS7.5 Error Code 0x8007007e HTTP 错误 500.19
- 调用CoCreateInstance 函数创建IGraphBuilder 返回值-2147221008 出现错误--directx9 directshow
- 笔记--“dll已经注册,但是用CoCreateInstance调用总是返回错误”
- CoCreateInstance
- CoCreateInstance
- CoCreateInstance
- UCenter 建站程序一览表
- 基于MSComm控件的串口调试程序(Z)
- JavaScript 设为主页与加入收藏
- JavaFX项目发布时虚拟机参数设置方法
- 玩转joomla文章模块
- CoCreateInstance失败,返回错误码0x8007007e
- Practical Guide to STL By Jeff Bogan
- 框架页面用户注销
- WINCE/WM5.0如何让安装完后自动运行程序
- 用Java接口实现回调函数的等价功能
- Zero Config+CodeBehind配置Struts
- 移动软交换中短消息业务的设计与实现
- MC嵌套访问的问题
- 我知道