直接返回Recordset对象,返回值的类型可以是*IDispach

解决方案 »

  1.   

    在IDL文件中不认IDispach,需要包含什么文件?
      

  2.   

    IDL文件不认IDispach,应该包含什么文件解决?
      

  3.   

    转载 acptvc 的回答!
    //helper.idl: IDL source for helper file
    import "msado15.idl";// R1ADOdrsExe.idl : IDL source for R1ADOdrsExe.dll
    //
    import "oaidl.idl";
    import "ocidl.idl";
    import "helper.idl";    // import ADO thru helper IDL file
    [
    object,
    uuid(DF009B5B-A5CB-11D2-9062-00C04FB1784D),
    dual,
    helpstring("Ir1DisRS Interface"),
    pointer_default(unique)
    ]
    interface Ir1DisRS : IDispatch
    {
    [id(1), helpstring("method getRS")] HRESULT getRS([in,optional,defaultvalue(88)] short GY, [out, retval] _Recordset **ppRS);
    [propput, id(2), helpstring("property ConnString")] HRESULT ConnString([in] BSTR newVal);
    [id(3), helpstring("method UpdateBat")] HRESULT UpdateBat(_Recordset *ppRS);
    };[
    uuid(DF009B4F-A5CB-11D2-9062-00C04FB1784D),
    version(1.0),
    helpstring("R1ADOdrsExe 1.0 Type Library")
    ]
    library R1ADODRSEXELib
    {
    importlib("stdole32.tlb");
    importlib("stdole2.tlb");
        importlib("c:\program files\common files\system\ado\msado15.dll");  // need ADO
    [
    uuid(DF009B5C-A5CB-11D2-9062-00C04FB1784D),
    helpstring("r1DisRS Class")
    ]
    coclass r1DisRS
    {
    [default] interface Ir1DisRS;
    };
    }