场景:
1. CComObject在调用CreateInstance时崩溃了, 调试发现_pAtlModule是NULL.
2. 解决办法,在Main函数里添加.或者new CComModule, 总之在调用CComObject前先初始化_pAtlModule.
CComModule _Module;
_pAtlModule = &_Module;
转载: 原文地址
Hi,
I think the reason is: your program hasn't its own Module(_Module) defined in the code.
In the atlbase.h, there is:
class CAtlModule;
__declspec(selectany) CAtlModule* _pAtlModule = NULL;
In the CAtlModule's constructor, "this" module will be assigned to _pAtlModule, so your program should have its own Module, you could add below code in your program to solve this problem:
CComModule _Module;
extern __declspec(selectany) CAtlModule* _pAtlModule;
_pAtlModule = &_Module;
本文探讨了CComObject在调用CreateInstance时发生崩溃的问题,并提供了详细的解决方案。问题出现的原因在于程序中未定义自己的模块(_Module),解决方法是在程序中添加相应的模块定义。
1245

被折叠的 条评论
为什么被折叠?



