MFC(vs2010)操作Excel type lib

一开始使用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

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

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

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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值