`
lc7cl
  • 浏览: 40775 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

MFC(vs2010)操作Excel type lib

    博客分类:
  • VC
 
阅读更多

一开始使用vc6,在导入excel.exe后会自动生成excel.h和excel.cpp,然后project可以编译通过。

后来换到了vs2010,同样是导入excel.exe,但project无法通过编译,报了一堆错误,全都分布在excel.tlh和excel.thi里面,搞了一天最后终于解决了!但问题原因依然莫名奇妙!坑爹的MS啊!

 

 

PS:

 

vc中嵌入excel的链接

 

http://support.microsoft.com/kb/307473

 

http://support.microsoft.com/kb/311546/en-us

 

解决问题的链接

 

http://support.microsoft.com/kb/316587

 

 

 

 

 

 

编译时出现的出现:

 

 

 

1>e:\code\visual studio 2010\projects\simapp\simapp\debug\excel.tlh(550): error C3121: cannot change GUID for class 'IFilter'

1>          c:\program files\microsoft sdks\windows\v7.0a\include\filter.h(183) : see declaration of 'IFilter'

1>e:\code\visual studio 2010\projects\simapp\simapp\debug\excel.tlh(1471): error C2371: 'FontPtr' : redefinition; different basic types

1>          d:\program files\microsoft visual studio 10.0\vc\include\comdef.h(314) : see declaration of 'FontPtr'

1>e:\code\visual studio 2010\projects\simapp\simapp\debug\excel.tlh(1549): error C2786: 'BOOL (HDC,int,int,int,int)' : invalid operand for __uuidof

1>e:\code\visual studio 2010\projects\simapp\simapp\debug\excel.tlh(1549): error C2923: '_com_IIID' : 'Rectangle' is not a valid template type argument for parameter '_Interface'

1>          c:\program files\microsoft sdks\windows\v7.0a\include\wingdi.h(3989) : see declaration of 'Rectangle'

1>e:\code\visual studio 2010\projects\simapp\simapp\debug\excel.tlh(1549): error C3203: '_com_IIID' : unspecialized class template can't be used as a template argument for template parameter '_IIID', expected a real type

1>e:\code\visual studio 2010\projects\simapp\simapp\debug\excel.tlh(1549): error C2955: '_com_IIID' : use of class template requires template argument list

1>          d:\program files\microsoft visual studio 10.0\vc\include\comip.h(40) : see declaration of '_com_IIID'

1>e:\code\visual studio 2010\projects\simapp\simapp\debug\excel.tlh(1553): error C2786: 'BOOL (HDC,int,int,int,int,int,int,int,int)' : invalid operand for __uuidof

1>e:\code\visual studio 2010\projects\simapp\simapp\debug\excel.tlh(1553): error C2923: '_com_IIID' : 'Arc' is not a valid template type argument for parameter '_Interface'

1>          c:\program files\microsoft sdks\windows\v7.0a\include\wingdi.h(3235) : see declaration of 'Arc'

1>e:\code\visual studio 2010\projects\simapp\simapp\debug\excel.tlh(1553): error C3203: '_com_IIID' : unspecialized class template can't be used as a template argument for template parameter '_IIID', expected a real type

1>e:\code\visual studio 2010\projects\simapp\simapp\debug\excel.tlh(1553): error C2955: '_com_IIID' : use of class template requires template argument list

1>          d:\program files\microsoft visual studio 10.0\vc\include\comip.h(40) : see declaration of '_com_IIID'

1>e:\code\visual studio 2010\projects\simapp\simapp\debug\excel.tlh(1560): error C2371: 'PicturePtr' : redefinition; different basic types

1>          d:\program files\microsoft visual studio 10.0\vc\include\comdef.h(328) : see declaration of 'PicturePtr'

1>e:\code\visual studio 2010\projects\simapp\simapp\debug\excel.tlh(2046): error C2504: '_IMsoDispObj' : base class undefined

1>e:\code\visual studio 2010\projects\simapp\simapp\debug\excel.tlh(2088): error C2504: '_IMsoDispObj' : base class undefined

1>e:\code\visual studio 2010\projects\simapp\simapp\debug\excel.tlh(2190): error C2504: '_IMsoDispObj' : base class undefined

1>e:\code\visual studio 2010\projects\simapp\simapp\debug\excel.tlh(2209): error C2146: syntax error : missing ';' before identifier 'GetRGB'

1>e:\code\visual studio 2010\projects\simapp\simapp\debug\excel.tlh(2209): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int

1>e:\code\visual studio 2010\projects\simapp\simapp\debug\excel.tlh(2209): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int

1>e:\code\visual studio 2010\projects\simapp\simapp\debug\excel.tlh(2209): warning C4183: 'GetRGB': missing return type; assumed to be a member function returning 'int'

1>e:\code\visual studio 2010\projects\simapp\simapp\debug\excel.tlh(2211): error C2061: syntax error : identifier 'MsoRGBType'

1>e:\code\visual studio 2010\projects\simapp\simapp\debug\excel.tlh(2230): error C2061: syntax error : identifier 'MsoRGBType'

1>e:\code\visual studio 2010\projects\simapp\simapp\debug\excel.tlh(2232): error C2061: syntax error : identifier 'MsoRGBType'

1>e:\code\visual studio 2010\projects\simapp\simapp\debug\excel.tlh(2251): error C2504: '_IMsoDispObj' : base class undefined

1>e:\code\visual studio 2010\projects\simapp\simapp\debug\excel.tlh(2381): error C2504: '_IMsoDispObj' : base class undefined

1>e:\code\visual studio 2010\projects\simapp\simapp\debug\excel.tlh(2420): error C2504: '_IMsoDispObj' : base class undefined

1>e:\code\visual studio 2010\projects\simapp\simapp\debug\excel.tlh(2503): error C2504: '_IMsoDispObj' : base class undefined

……………………………………

……………………………………

……………………………………

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics