首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > VC/MFC >

ActiveX控件初始化失败,COleControl:InitializeIIDs中止了程序

2012-06-21 
ActiveX控件初始化失败,COleControl::InitializeIIDs中断了程序编写一个ActiveX控件,用VC自带的容易测试时

ActiveX控件初始化失败,COleControl::InitializeIIDs中断了程序

编写一个ActiveX控件,用VC自带的容易测试时,程序中断到COleControl::InitializeIIDs函数中的一个位置,该函数内容如下:
void COleControl::InitializeIIDs(const IID* piidPrimary, const IID* piidEvents)
{
 m_piidPrimary = piidPrimary;
 m_piidEvents = piidEvents;

 EnableTypeLib();

 // Initialize the masks for stock events and properties.
 InitStockEventMask();
 InitStockPropMask();

#ifdef _DEBUG

 // Verify that the type library contains all the correct information.
 // If any of the following assertions fail, carefully check the IDs
 // in the control's .CPP file against those in its .ODL file.

 LPTYPEINFO pTypeInfo;
 HRESULT hr;
 CLSID clsid;

 GetClassID(&clsid);
 if (SUCCEEDED(hr = GetTypeInfoOfGuid(0, clsid, &pTypeInfo)))
  RELEASE(pTypeInfo);

 ASSERT(SUCCEEDED(hr)); // Class ID may be corrupted

 if (SUCCEEDED(hr = GetTypeInfoOfGuid(0, *m_piidPrimary, &pTypeInfo)))
  RELEASE(pTypeInfo);

 ASSERT(SUCCEEDED(hr)); // Primary dispatch interface ID may be corrupted

 if (SUCCEEDED(hr = GetTypeInfoOfGuid(0, *m_piidEvents, &pTypeInfo)))
  RELEASE(pTypeInfo);

 ASSERT(SUCCEEDED(hr)); // Event dispatch interface ID may be corrupted

#endif
}
中断的位置是第一个ASSERT函数处,请问这个问题产生的原因,如何解决,多谢高手


[解决办法]
ASSERT(SUCCEEDED(hr)); // Class ID may be corrupted

热点排行