您现在的位置:计算机技术学习网 > 技术中心 > 编程开发 > C >

ADO编程中ATL所遇到的定义问题

来源:网络收集 责任编辑:栏目编辑 发表时间:2013-07-01 17:21 点击:
当欲向接口中定义方法如下:



[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;

       };

};
 





    相关新闻>>

      发表评论
      请自觉遵守互联网相关的政策法规,严禁发布色情、暴力、反动的言论。
      用户名: 验证码:点击我更换图片
      最新评论 更多>>
      网站首页 - 友情链接 - 网站地图 - TAG标签 - RSS订阅 - 内容搜索
      Copyright © 2008-2015 计算机技术学习交流网. 版权所有

      豫ICP备11007008号-1