stdole2.tlb导入时的问题
我在程序中需要使用iFontDispPtr智能指针,可是我在stdafx.h中做了如下的定义和导入.
//#define __IFontDisp_INTERFACE_DEFINED__
#include <afxwin.h> // MFC core and standard components
#include <afxext.h> // MFC extensions
#include <afxdisp.h> // MFC Automation classes
#include <afxdtctl.h> // MFC support for Internet Explorer 4 Common Controls
#ifndef _AFX_NO_AFXCMN_SUPPORT
#include <afxcmn.h> // MFC support for Windows Common Controls
//导入ArcInfo的类库文件
#pragma warning (disable : 4192) // automatically excluding 'Interface' while importing type library
#pragma warning (disable : 4146) // unary minus operator applied to unsigned type
#pragma warning (disable : 4786) //禁掉自动化警告
#import "esricore.olb" raw_interfaces_only,raw_native_types, named_guids, exclude("OLE_COLOR", "OLE_HANDLE")
using namespace esriCore;
#define INITGUID
#import "d:\Program Files\Common Files\system\ado\msado15.dll" rename_namespace("ADODB") rename("EOF", "adoEOF") rename("BOF", "adoBOF")
using namespace ADODB;
//使用ado访问数据库
#import "d:\Program Files\Common Files\system\ole db\oledb32.dll" raw_interfaces_only,exclude("IDBPromptInitialize", "IDataInitialize") no_auto_exclude
#import "D:\WINDOWS\system32\stdole2.tlb" raw_native_types,named_guids,exclude("OLE_COLOR", "OLE_HANDLE","DISPPARAMS","EXCEPINFO")
using namespace stdole;
//导入结束
出错的代码段是:
IFontDispPtr pfont;
pfont->PutName(_bstr_t(name));
pfont->PutSize(textHeight);
现在在使用iFontDispPtr时出现提示的错误信息:
C:\打印程序\showmap\MyLayout.cpp(730) : error C2039: 'PutName' : is not a member of 'IFontDisp'
d:\program files\microsoft visual studio\vc98\include\ocidl.h(4800) : see declaration of 'IFontDisp'
C:\打印程序\showmap\MyLayout.cpp(731) : error C2039: 'PutSize' : is not a member of 'IFontDisp'
d:\program files\microsoft visual studio\vc98\include\ocidl.h(4800) : see declaration of 'IFontDisp'
备注:
在ocidl中也有一个IFontDispPtr的定义,并且和stdole2中的定义不一样,我需要使用stdole2中的IFontDispPtr定义,这个定义有上面提供的方法,请那位兄弟帮忙解决,分不够我可以多给