ADO编程中ATL所遇到的定义问题
2004-12-08 17:06
489 查看
ADO编程中ATL所遇到的定义问题
当欲向接口中定义方法如下:
[id(1), helpstring("method SearchCust")] HRESULT SearchCust([in] BSTR bstrcustid,[out,retval] _Recordset **ptr);
由于用到_Recordset类型,所以必须
importlib("C:/Program Files/Common Files/System/ADO/MSADO15.DLL");
于是整个idl文件应该改写为以下方式:
// FindCust.idl : IDL source for FindCust.dll
//
// This file will be processed by the MIDL tool to
// produce the type library (FindCust.tlb) and marshalling code.
import "oaidl.idl";
import "ocidl.idl";
[
uuid(B32A7D72-12D4-11D5-AC09-00A0247A8577),
version(1.0),
helpstring("FindCust 1.0 Type Library")
]
library FINDCUSTLib //Library给手动提前了
{
importlib("stdole32.tlb");
importlib("stdole2.tlb");
//MODIFY HERE
importlib("C:/Program Files/Common Files/System/ADO/MSADO15.DLL");
[
object,
uuid(B32A7D7F-12D4-11D5-AC09-00A0247A8577),
dual,
helpstring("ISearch Interface"),
pointer_default(unique)
]
interface ISearch : IDispatch
{
[id(1), helpstring("method SearchCust")] HRESULT SearchCust([in] BSTR bstrcustid,[out,retval] _Recordset **ptr);
};
[
uuid(B32A7D81-12D4-11D5-AC09-00A0247A8577),
helpstring("_ISearchEvents Interface")
]
dispinterface _ISearchEvents
{
properties:
methods:
};
[
uuid(B32A7D80-12D4-11D5-AC09-00A0247A8577),
helpstring("Search Class")
]
coclass Search
{
[default] interface ISearch;
[default, source] dispinterface _ISearchEvents;
};
};
当欲向接口中定义方法如下:
[id(1), helpstring("method SearchCust")] HRESULT SearchCust([in] BSTR bstrcustid,[out,retval] _Recordset **ptr);
由于用到_Recordset类型,所以必须
importlib("C:/Program Files/Common Files/System/ADO/MSADO15.DLL");
于是整个idl文件应该改写为以下方式:
// FindCust.idl : IDL source for FindCust.dll
//
// This file will be processed by the MIDL tool to
// produce the type library (FindCust.tlb) and marshalling code.
import "oaidl.idl";
import "ocidl.idl";
[
uuid(B32A7D72-12D4-11D5-AC09-00A0247A8577),
version(1.0),
helpstring("FindCust 1.0 Type Library")
]
library FINDCUSTLib //Library给手动提前了
{
importlib("stdole32.tlb");
importlib("stdole2.tlb");
//MODIFY HERE
importlib("C:/Program Files/Common Files/System/ADO/MSADO15.DLL");
[
object,
uuid(B32A7D7F-12D4-11D5-AC09-00A0247A8577),
dual,
helpstring("ISearch Interface"),
pointer_default(unique)
]
interface ISearch : IDispatch
{
[id(1), helpstring("method SearchCust")] HRESULT SearchCust([in] BSTR bstrcustid,[out,retval] _Recordset **ptr);
};
[
uuid(B32A7D81-12D4-11D5-AC09-00A0247A8577),
helpstring("_ISearchEvents Interface")
]
dispinterface _ISearchEvents
{
properties:
methods:
};
[
uuid(B32A7D80-12D4-11D5-AC09-00A0247A8577),
helpstring("Search Class")
]
coclass Search
{
[default] interface ISearch;
[default, source] dispinterface _ISearchEvents;
};
};
相关文章推荐
- 切勿锁定类型对象(转msdn)
- Delphi 组件编写--扑克牌组件
- Eclipse 使用秘籍
- 成为编程高手的八大奥秘
- 关于JSF和Struts的讨论
- ASP与数据库应用(给初学者)
- ASP数据库简单操作教程
- 在PHP中执行系统外部命令
- 续实例解析SOCKET编程模型之异步通信篇-客户端
- cdo發送郵件時smtp驗證方式的設置(設置錯誤發送郵件時會報錯)
- 续实例解析SOCKET编程模型之异步通信篇-服务器
- 实例解析SOCKET编程模型-客户端
- 实例解析SOCKET编程模型-服务器
- 编程修养
- Avalon 与 Avalon CTP的区别
- 用VC++编制FTP客户端应用程序
- 每个.NET 开发人员应该下载的十个必备工具
- Excel编程中关于跨列单元格的自适应高度的解决办法
- 关于ASP访问ACCESS数据的“不能打开注册表关键字”80004005错误的探讨
- 学习的asp.net的办法 [转论坛]