ADO编程中ATL所遇到的定义问题
ADO編程中ATL所遇到的定義問題?
?
?
當(dāng)欲向接口中定義方法如下:
[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");
?
于是整個(gè)idl文件應(yīng)該改寫為以下方式:
// 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;
?????? };
};
?
總結(jié)
以上是生活随笔為你收集整理的ADO编程中ATL所遇到的定义问题的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: [MATLAB调试笔记]phase sp
- 下一篇: 教你用python爬取网站数据