IDL文件里面是如下内容
//---------------------------------------------------------------------
import "oaidl.idl";
import "ocidl.idl";
import "unknwn.idl";
import "oleidl.idl";
import "urlmon.idl";[ object,
uuid(988934A4-064B-11D3-BB80-00104B35E7F9),
helpstring("IIDownloadManager Interface"),
pointer_default(unique),
local
]
interface IIDownloadManager : IUnknown
{
HRESULT Download(
[in] IMoniker *pmk, // Identifies the object to be downloaded
[in] IBindCtx *pbc, // Stores information used by the moniker to bind
[in] DWORD dwBindVerb, // The action to be performed during the bind
[in] LONG grfBINDF, // Determines the use of URL encoding during the bind
[in] BINDINFO *pBindInfo, // Used to implement IBindStatusCallback::GetBindInfo
[in] LPCOLESTR pszHeaders, // Additional headers to use with IHttpNegotiate
[in] LPCOLESTR pszRedir, // The URL that the moniker is redirected to
[in] UINT uiCP // The code page of the object's display name
); };[
uuid(F235EC7A-4D21-44B8-8143-EFB9C134B18F),
version(1.0),
helpstring("FinalTest 1.0 Type Library")
]
library FINALTESTLib
{
importlib("stdole32.tlb");
importlib("stdole2.tlb"); [
uuid(CE74899B-1315-4919-83FE-003FCE8FC528),
helpstring("IDownloadManager Class")
]
coclass IDownloadManager
{
[default] interface IIDownloadManager;
};
};
//-----------------------------------------------------------------------------------------------
编译出错:
error MIDL2139 : type of the parameter cannot derive from void or void * : [ Type 'LPVOID' ( Parameter 'pBindInfo' ) ]
Error executing midl.exe.然后我参照了另外一种写法,加了LOCAL,但是出现另外的错误:
D:\Program Files\Microsoft Visual Studio\VC98\ATL\INCLUDE\atlcom.h(1827) : error C2259: 'CComObject<class CIDownloadManager>' : cannot instantiate abstract class due to following members:
D:\Program Files\Microsoft Visual Studio\VC98\ATL\INCLUDE\atlcom.h(1823) : while compiling class-template member function 'long __stdcall ATL::CComCreator<class ATL::CComObject<class CIDownloadManager> >::CreateInstance(void *,const struct _
GUID &,void ** )'
D:\Program Files\Microsoft Visual Studio\VC98\ATL\INCLUDE\atlcom.h(1827) : warning C4259: 'long __stdcall IIDownloadManager::Download(struct IMoniker *,struct IBindCtx *,unsigned long,long,struct _tagBINDINFO *,const unsigned short *,const unsigned
short *,unsigned int)' : pure virtual function was not defined
G:\COM组件开发\FinalTest\FinalTest.h(80) : see declaration of 'Download'
D:\Program Files\Microsoft Visual Studio\VC98\ATL\INCLUDE\atlcom.h(1823) : while compiling class-template member function 'long __stdcall ATL::CComCreator<class ATL::CComObject<class CIDownloadManager> >::CreateInstance(void *,const struct _
GUID &,void ** )'
D:\Program Files\Microsoft Visual Studio\VC98\ATL\INCLUDE\atlcom.h(1827) : error C2259: 'CComObject<class CIDownloadManager>' : cannot instantiate abstract class due to following members:
D:\Program Files\Microsoft Visual Studio\VC98\ATL\INCLUDE\atlcom.h(1823) : while compiling class-template member function 'long __stdcall ATL::CComCreator<class ATL::CComObject<class CIDownloadManager> >::CreateInstance(void *,const struct _
GUID &,void ** )'
D:\Program Files\Microsoft Visual Studio\VC98\ATL\INCLUDE\atlcom.h(1827) : warning C4259: 'long __stdcall IIDownloadManager::Download(struct IMoniker *,struct IBindCtx *,unsigned long,long,struct _tagBINDINFO *,const unsigned short *,const unsigned
short *,unsigned int)' : pure virtual function was not defined
G:\COM组件开发\FinalTest\FinalTest.h(80) : see declaration of 'Download'
D:\Program Files\Microsoft Visual Studio\VC98\ATL\INCLUDE\atlcom.h(1823) : while compiling class-template member function 'long __stdcall ATL::CComCreator<class ATL::CComObject<class CIDownloadManager> >::CreateInstance(void *,const struct _
GUID &,void ** )'这个接口一定要实现才行啊,但是我真的不知道应该怎么做了,请高手帮忙啊!!!
//---------------------------------------------------------------------
import "oaidl.idl";
import "ocidl.idl";
import "unknwn.idl";
import "oleidl.idl";
import "urlmon.idl";[ object,
uuid(988934A4-064B-11D3-BB80-00104B35E7F9),
helpstring("IIDownloadManager Interface"),
pointer_default(unique),
local
]
interface IIDownloadManager : IUnknown
{
HRESULT Download(
[in] IMoniker *pmk, // Identifies the object to be downloaded
[in] IBindCtx *pbc, // Stores information used by the moniker to bind
[in] DWORD dwBindVerb, // The action to be performed during the bind
[in] LONG grfBINDF, // Determines the use of URL encoding during the bind
[in] BINDINFO *pBindInfo, // Used to implement IBindStatusCallback::GetBindInfo
[in] LPCOLESTR pszHeaders, // Additional headers to use with IHttpNegotiate
[in] LPCOLESTR pszRedir, // The URL that the moniker is redirected to
[in] UINT uiCP // The code page of the object's display name
); };[
uuid(F235EC7A-4D21-44B8-8143-EFB9C134B18F),
version(1.0),
helpstring("FinalTest 1.0 Type Library")
]
library FINALTESTLib
{
importlib("stdole32.tlb");
importlib("stdole2.tlb"); [
uuid(CE74899B-1315-4919-83FE-003FCE8FC528),
helpstring("IDownloadManager Class")
]
coclass IDownloadManager
{
[default] interface IIDownloadManager;
};
};
//-----------------------------------------------------------------------------------------------
编译出错:
error MIDL2139 : type of the parameter cannot derive from void or void * : [ Type 'LPVOID' ( Parameter 'pBindInfo' ) ]
Error executing midl.exe.然后我参照了另外一种写法,加了LOCAL,但是出现另外的错误:
D:\Program Files\Microsoft Visual Studio\VC98\ATL\INCLUDE\atlcom.h(1827) : error C2259: 'CComObject<class CIDownloadManager>' : cannot instantiate abstract class due to following members:
D:\Program Files\Microsoft Visual Studio\VC98\ATL\INCLUDE\atlcom.h(1823) : while compiling class-template member function 'long __stdcall ATL::CComCreator<class ATL::CComObject<class CIDownloadManager> >::CreateInstance(void *,const struct _
GUID &,void ** )'
D:\Program Files\Microsoft Visual Studio\VC98\ATL\INCLUDE\atlcom.h(1827) : warning C4259: 'long __stdcall IIDownloadManager::Download(struct IMoniker *,struct IBindCtx *,unsigned long,long,struct _tagBINDINFO *,const unsigned short *,const unsigned
short *,unsigned int)' : pure virtual function was not defined
G:\COM组件开发\FinalTest\FinalTest.h(80) : see declaration of 'Download'
D:\Program Files\Microsoft Visual Studio\VC98\ATL\INCLUDE\atlcom.h(1823) : while compiling class-template member function 'long __stdcall ATL::CComCreator<class ATL::CComObject<class CIDownloadManager> >::CreateInstance(void *,const struct _
GUID &,void ** )'
D:\Program Files\Microsoft Visual Studio\VC98\ATL\INCLUDE\atlcom.h(1827) : error C2259: 'CComObject<class CIDownloadManager>' : cannot instantiate abstract class due to following members:
D:\Program Files\Microsoft Visual Studio\VC98\ATL\INCLUDE\atlcom.h(1823) : while compiling class-template member function 'long __stdcall ATL::CComCreator<class ATL::CComObject<class CIDownloadManager> >::CreateInstance(void *,const struct _
GUID &,void ** )'
D:\Program Files\Microsoft Visual Studio\VC98\ATL\INCLUDE\atlcom.h(1827) : warning C4259: 'long __stdcall IIDownloadManager::Download(struct IMoniker *,struct IBindCtx *,unsigned long,long,struct _tagBINDINFO *,const unsigned short *,const unsigned
short *,unsigned int)' : pure virtual function was not defined
G:\COM组件开发\FinalTest\FinalTest.h(80) : see declaration of 'Download'
D:\Program Files\Microsoft Visual Studio\VC98\ATL\INCLUDE\atlcom.h(1823) : while compiling class-template member function 'long __stdcall ATL::CComCreator<class ATL::CComObject<class CIDownloadManager> >::CreateInstance(void *,const struct _
GUID &,void ** )'这个接口一定要实现才行啊,但是我真的不知道应该怎么做了,请高手帮忙啊!!!
解决方案 »
- debug
- 字符集的定义和CFile函数GetLength的问题
- 多文档窗口背景画不上去...
- 菜鸟有问题需您帮助解决
- Windows 任务栏系统小图标右键弹出菜单问题!
- 从AutoCAD2000到AutoCAD2004 dxf文件格式有哪些更新和变化?
- 请教高手矢量多边形合成的算法
- 学习《COM技术内幕》的一个小问题。
- 程序开发者的理想伴侣 - MyCSDN论坛库0.90(beta),欢迎下载试用~~~~
- 为什么我写的ActiveX控件,在VB的属性页里就是看不我的自定义属性?
- 如何实现BUTTON按钮的加载图 Windwos SDK开发
- vs2008 MFC dll项目在哪里设置可以在生成时产生*.lib文件?
Implemented IDownloadManagerIDownloadManager有一个成员函数,原型如下,HRESULT Download(
IMoniker *pmk,
IBindCtx *pbc,
DWORD dwBindVerb,
LONG grfBINDF,
BINDINFO *pBindInfo,
LPCOLESTR pszHeaders,
LPCOLESTR pszRedir,
UINT uiCP
);IMoniker,IBindCtx,BINDINFO,可能会比较麻烦,没关系,这里有现成的,
http://www.mvps.org/emorcillo/download/vb6/tl_ole.zip
(引用页,http://www.mvps.org/emorcillo/en/code/vb6/wbframe.shtml)
有源码,可以自己编译,然后那个odl文件这样写就行了,interface IDownloadManager;
[
odl,
uuid(988934A4-064B-11D3-BB80-00104B35E7F9), // IID_IDownloadManager
]
interface IDownloadManager : IUnknown
{
HRESULT Download(
[in] IMoniker *pmk, // Identifies the object to be downloaded
[in] IBindCtx *pbc, // Stores information used by the moniker to bind
[in] LONG dwBindVerb, // The action to be performed during the bind
[in] LONG grfBINDF, // Determines the use of URL encoding during the bind
[in] BINDINFO *pBindInfo, // Used to implement IBindStatusCallback::GetBindInfo
//[in] LPCOLESTR pszHeaders, // Additional headers to use with IHttpNegotiate
[in] long pszHeaders,
//[in] LPCOLESTR *pszRedir, // The URL that the moniker is redirected to
[in] long pszRedir,
[in] LONG uiCP // The code page of the object's display name
);
};
//----------------------------------------------------------------------------------------------------------------