操作OFFICE需加载OFFICE的库,但同时加载又会带来重名问题#include <stdio.h>
#include <tchar.h>#import "C:\\Program Files\\common files\\microsoft shared\\office12\\MSO.dll"\
rename(_T("RGB"), _T("RGBEx"))\
rename(_T("EOF"), _T("msoEOF"))\
rename("SearchPath","MsoSearchPath")\
rename("DocumentProperties", "MSODocumentProperties")\
rename("DocumentProperties", "DocumentPropertiesXL") exclude("IFont","IPicture")
using namespace Office;#import "C:\\Program Files\\Common Files\\Microsoft Shared\\VBA\\VBA6\\VBE6EXT.OLB"
using namespace VBIDE; #import "D:\\Program Files\\Microsoft Office\\OFFICE12\\MSWORD.OLB"  \
rename("ExitWindows","ExitWindowsEx")\
rename("FindText", "FindTextEx")using namespace Word;
#import "D:\\Program Files\\Microsoft Office\\Office12\\MSPPT.OLB"\
rename(_T("RGB"), _T("VisioRGB"))\
//rename("Application","ppt_Application")
using namespace PowerPoint;
#import "D:\\Program Files\\Microsoft Office\\OFFICE12\\EXCEL.EXE" \
rename(_T("DialogBox"), _T("ExcelDialogBox") ) \
rename( _T("RGB"), _T("ExcelRGB") ) \
rename( _T("CopyFile"), _T("ExcelCopyFile") ) \
rename( _T("ReplaceText"), _T("ExcelReplaceText") )\
exclude( "IFont", "IPicture" ) no_dual_interfaces 
报错为:
非常多类似的错误
 error C2872: “ColorFormat”: 不明确的符号
 msppt.tlh(1151) : PowerPoint::ColorFormat”
msword.tlh(17730) : Word::ColorFormat”
“Window”: 不明确的符号
1>          可能是“f:\mycode\judgeencrypt\bisencrypt\bisencrypt\debug\msword.tlh(25303) : Word::Window”
1>          或       “f:\mycode\judgeencrypt\bisencrypt\bisencrypt\debug\vbe6ext.tlh(700) : VBIDE::Window”
1>f:\mycode\judgeencrypt\bisencrypt\bisencrypt\stdafx.h(57): error C2872: “Window”: 不明确的符号
1>          可能是“f:\mycode\judgeencrypt\bisencrypt\bisencrypt\debug\msword.tlh(25303) : Word::Window”
1>          或       “f:\mycode\judgeencrypt\bisencrypt\bisencrypt\debug\vbe6ext.tlh(700) : VBIDE::Window”
急等解释...