用VS2003做ATL ActiveX开发,遇到以下问题。
步骤:
1、利用VC7的“ATL 项目”向导建立的ActiveX工程,(注意:“属性化”选项默认是选中的,保持不变)
2、在工程中添加“ATL 控件”
3、给已添加的ATL 控件添加一个BSTR类型的属性
4、编译控件
5、Debug控件,在调用控件的BSTR属性时出错,跟踪后错误断点出现在atlcom.h文件的
//If InternalAddRef or InternalRelease is undefined then your class
 //doesn't derive from CComObjectRoot
 STDMETHOD_(ULONG, AddRef)() {return InternalAddRef();}
 STDMETHOD_(ULONG, Release)()
 {
  ULONG l = InternalRelease();
  if (l == 0)
   delete this;
  return l;
 }
方法处。

解决办法:
用“ATL 项目”向导建立ActiveX工程时,去掉工程的“属性化”选项即可。这应该是VC7的Bug

 

相关文章:

  • 2021-09-04
  • 2021-11-16
  • 2021-11-20
  • 2021-10-04
  • 2022-12-23
  • 2021-09-17
猜你喜欢
  • 2021-07-19
  • 2021-05-18
  • 2022-12-23
  • 2022-01-02
  • 2021-10-26
  • 2022-12-23
  • 2022-01-13
相关资源
相似解决方案