调用EXCEL的COM:
在stdafx.h里添加
#include <ole2.h>
#include <stdio.h>
#pragma warning (disable:4146)
#pragma warning (disable:4192)
#pragma warning (disable:4049)#import "d:\Program Files\Microsoft Office\Office\MSO9.dll"
#import "C:\Program Files\Common Files\Microsoft Shared\VBA\VBA6\VBE6EXT.OLB" no_namespace
//#import "d:\Program Files\Microsoft Office\Office\MSWORD9.OLB" rename("ExitWindows","_ExitWindows")
#import "d:\Program Files\Microsoft Office\Office\excel9.olb" rename("DialogBox", "DialogBoxXL") rename("RGB", "RBGXL") \
rename("DocumentProperties", "DocumentPropertiesXL") exclude("IFont","IPicture")调用ADO:
在MYVIEW里添加
#import "C:\program files\common files\system\ado\msado15.dll" no_namespace rename("EOF","ADOEOF")程序出现很多错误;
Compiling...
DEMOView.cpp
e:\myproject\demo\debug\msado15.tlh(26) : error C2367: 'Properties' : redefinition; different uuid specifiers
e:\myproject\demo\debug\vbe6ext.tlh(92) : see declaration of 'Properties'
e:\myproject\demo\debug\msado15.tlh(28) : error C2367: 'Property' : redefinition; different uuid specifiers
e:\myproject\demo\debug\vbe6ext.tlh(1308) : see declaration of 'Property'
e:\myproject\demo\debug\msado15.tlh(849) : error C2367: 'Properties' : redefinition; different uuid specifiers
e:\myproject\demo\debug\msado15.tlh(849) : see declaration of 'Properties'
e:\myproject\demo\debug\msado15.tlh(875) : error C2011: 'Property' : 'struct' type redefinition
e:\myproject\demo\debug\msado15.tli(76) : error C2084: function 'class _variant_t __thiscall Property::GetValue(void)' already has a body
e:\myproject\demo\debug\msado15.tli(84) : error C2084: function 'void __thiscall Property::PutValue(const class _variant_t &)' already has a body
e:\myproject\demo\debug\msado15.tli(89) : error C2084: function 'class _bstr_t __thiscall Property::GetName(void)' already has a body
e:\myproject\demo\debug\msado15.tli(96) : error C2039: 'GetType' : is not a member of 'Property'
e:\myproject\demo\debug\vbe6ext.tlh(1308) : see declaration of 'Property'
e:\myproject\demo\debug\msado15.tli(98) : error C2065: 'get_Type' : undeclared identifier
e:\myproject\demo\debug\msado15.tli(99) : error C2673: 'GetType' : global functions do not have 'this' pointers
e:\myproject\demo\debug\msado15.tli(99) : error C2673: 'GetType' : global functions do not have 'this' pointers
e:\myproject\demo\debug\msado15.tli(103) : error C2039: 'GetAttributes' : is not a member of 'Property'
e:\myproject\demo\debug\vbe6ext.tlh(1308) : see declaration of 'Property'
e:\myproject\demo\debug\msado15.tli(105) : error C2065: 'get_Attributes' : undeclared identifier
e:\myproject\demo\debug\msado15.tli(106) : error C2673: 'GetAttributes' : global functions do not have 'this' pointers
e:\myproject\demo\debug\msado15.tli(106) : error C2673: 'GetAttributes' : global functions do not have 'this' pointers
e:\myproject\demo\debug\msado15.tli(110) : error C2039: 'PutAttributes' : is not a member of 'Property'
e:\myproject\demo\debug\vbe6ext.tlh(1308) : see declaration of 'Property'
e:\myproject\demo\debug\msado15.tli(111) : error C2065: 'put_Attributes' : undeclared identifier
e:\myproject\demo\debug\msado15.tli(112) : error C2673: 'PutAttributes' : global functions do not have 'this' pointers
e:\myproject\demo\debug\msado15.tli(112) : error C2673: 'PutAttributes' : global functions do not have 'this' pointers
Error executing cl.exe.
我该怎么办???
在stdafx.h里添加
#include <ole2.h>
#include <stdio.h>
#pragma warning (disable:4146)
#pragma warning (disable:4192)
#pragma warning (disable:4049)#import "d:\Program Files\Microsoft Office\Office\MSO9.dll"
#import "C:\Program Files\Common Files\Microsoft Shared\VBA\VBA6\VBE6EXT.OLB" no_namespace
//#import "d:\Program Files\Microsoft Office\Office\MSWORD9.OLB" rename("ExitWindows","_ExitWindows")
#import "d:\Program Files\Microsoft Office\Office\excel9.olb" rename("DialogBox", "DialogBoxXL") rename("RGB", "RBGXL") \
rename("DocumentProperties", "DocumentPropertiesXL") exclude("IFont","IPicture")调用ADO:
在MYVIEW里添加
#import "C:\program files\common files\system\ado\msado15.dll" no_namespace rename("EOF","ADOEOF")程序出现很多错误;
Compiling...
DEMOView.cpp
e:\myproject\demo\debug\msado15.tlh(26) : error C2367: 'Properties' : redefinition; different uuid specifiers
e:\myproject\demo\debug\vbe6ext.tlh(92) : see declaration of 'Properties'
e:\myproject\demo\debug\msado15.tlh(28) : error C2367: 'Property' : redefinition; different uuid specifiers
e:\myproject\demo\debug\vbe6ext.tlh(1308) : see declaration of 'Property'
e:\myproject\demo\debug\msado15.tlh(849) : error C2367: 'Properties' : redefinition; different uuid specifiers
e:\myproject\demo\debug\msado15.tlh(849) : see declaration of 'Properties'
e:\myproject\demo\debug\msado15.tlh(875) : error C2011: 'Property' : 'struct' type redefinition
e:\myproject\demo\debug\msado15.tli(76) : error C2084: function 'class _variant_t __thiscall Property::GetValue(void)' already has a body
e:\myproject\demo\debug\msado15.tli(84) : error C2084: function 'void __thiscall Property::PutValue(const class _variant_t &)' already has a body
e:\myproject\demo\debug\msado15.tli(89) : error C2084: function 'class _bstr_t __thiscall Property::GetName(void)' already has a body
e:\myproject\demo\debug\msado15.tli(96) : error C2039: 'GetType' : is not a member of 'Property'
e:\myproject\demo\debug\vbe6ext.tlh(1308) : see declaration of 'Property'
e:\myproject\demo\debug\msado15.tli(98) : error C2065: 'get_Type' : undeclared identifier
e:\myproject\demo\debug\msado15.tli(99) : error C2673: 'GetType' : global functions do not have 'this' pointers
e:\myproject\demo\debug\msado15.tli(99) : error C2673: 'GetType' : global functions do not have 'this' pointers
e:\myproject\demo\debug\msado15.tli(103) : error C2039: 'GetAttributes' : is not a member of 'Property'
e:\myproject\demo\debug\vbe6ext.tlh(1308) : see declaration of 'Property'
e:\myproject\demo\debug\msado15.tli(105) : error C2065: 'get_Attributes' : undeclared identifier
e:\myproject\demo\debug\msado15.tli(106) : error C2673: 'GetAttributes' : global functions do not have 'this' pointers
e:\myproject\demo\debug\msado15.tli(106) : error C2673: 'GetAttributes' : global functions do not have 'this' pointers
e:\myproject\demo\debug\msado15.tli(110) : error C2039: 'PutAttributes' : is not a member of 'Property'
e:\myproject\demo\debug\vbe6ext.tlh(1308) : see declaration of 'Property'
e:\myproject\demo\debug\msado15.tli(111) : error C2065: 'put_Attributes' : undeclared identifier
e:\myproject\demo\debug\msado15.tli(112) : error C2673: 'PutAttributes' : global functions do not have 'this' pointers
e:\myproject\demo\debug\msado15.tli(112) : error C2673: 'PutAttributes' : global functions do not have 'this' pointers
Error executing cl.exe.
我该怎么办???
解决方案 »
- 关于VC程序报错需要关闭的问题
- 如何在属性页保证按ok后不退出(检查冲突做出提示的情况下)?我在propertyPage里OnOk里作了屏蔽还是退出:(
- VC++实效编程百例里的播放WAV文件的问题
- 怎么播放 已经添加入 资源 的mp3
- 请问一下子,怎么样可以删除程序的所有注释
- 网络数据包的问题???
- 为什么用GetPrivateProfileString 来读取ini文件在2000以上的系统能读取到正确的值,而在98以下的系统读不出值呢?在线等!!
- 哪有免费的条形码 39码的字体下载,
- 怎么从一个基于对话框的程序中(EXE)导出一些数据到ATL的DLL中?
- 请问线程间通信的方法有那几种??
- 请教判断电子邮件数量的问题
- 一个有关ODBC和EXCEL的问题
#import "E:\Program Files\Common Files\Microsoft Shared\Office10\MSO.DLL"
#import "E:\Program Files\Common Files\Microsoft Shared\VBA\VBA6\VBE6EXT.OLB" \
rename_namespace("VBIDE")
#import "E:\Program Files\Microsoft Office\Office10\Excel.EXE" \
rename("DialogBox", "DialogBoxXL") \
rename("RGB", "RGBXL") \
rename("ExitWindows", "ExitWindowsXL") \
rename("DocumentProperties", "DocumentPropertiesXL") \
no_auto_exclude
#import "E:\Program files\Microsoft Office\Office10\MSWORD.OLB" \
rename("DialogBox", "DialogBoxDoc") \
rename("RGB", "RGBDoc") \
rename("ExitWindows", "ExitWindowsDoc") \
rename("DocumentProperties", "DocumentPropertiesDoc") \
no_auto_exclude
#endif#ifdef __OFFICE_2000
#import "E:\Program Files\Microsoft Office\Office\MSO9.DLL"
#import "E:\Program Files\Common Files\Microsoft Shared\VBA\VBA6\VBE6EXT.OLB" \
rename_namespace("VBIDE")
#import "E:\Program Files\Microsoft Office\Office\EXCEL9.OLB" \
rename("DialogBox", "DialogBoxXL") \
rename("RGB", "RGBXL") \
rename("ExitWindows", "ExitWindowsXL") \
rename("DocumentProperties", "DocumentPropertiesXL") \
no_auto_exclude
#import "E:\Program files\Microsoft Office\Office\MSWORD9.OLB" \
rename("DialogBox", "DialogBoxDoc") \
rename("RGB", "RGBDoc") \
rename("ExitWindows", "ExitWindowsDoc") \
rename("DocumentProperties", "DocumentPropertiesDoc") \
no_auto_exclude
#endif#ifdef __OFFICE_97
#define IMPATTRS rename("DocumentProperties", "DocProps")
#import "mso97.dll" IMPATTRS
#import "vbeext1.olb" rename_namespace("VBIDE")
#import "excel8.olb" IMPATTRS rename("DialogBox", "DialogBoxXL") \
rename("RGB", "RGBXL") \
rename("ExitWindows", "ExitWindowsXL") \
rename("DocumentProperties", "DocumentPropertiesXL") \
rename("_CommandBars", "CommandBarsXL") \
no_auto_exclude
#import "msword8.olb" rename("DialogBox","dialogBoxDOC") \
rename("RGB","RGBDOC") no_auto_exclude \
rename("ExitWindows","WordExitWindows") no_auto_exclude
#endif#import "msado21.tlb" rename("EOF", "adoEOF")