1

为了更正枚举值名称的问题,在搜索之后,我需要修改我的 DLL 的 TLB 文件。我需要做的第一步是创建 IDL 文件。所以我使用 Oleview 创建文件。在进行修改以纠正我的问题之前,我决定尝试编译 IDL 文件。这给了我错误:

error MIDL2025 : syntax error : expecting a type specification near "AzEnumParameters"

搜索问题后,我发现这个问题是纠正错误的方法。所以我改变了地方的枚举定义,现在我得到了这个错误:

error MIDL2025 : syntax error : expecting a constant expression near "<"
error MIDL2035 : constant expression expected
error MIDL2025 : syntax error : expecting ) near "IUnknown"

我不知道是什么导致了错误,因为我只反转了我的枚举定义和函数定义。是什么导致我的文件中的最后一个错误?

// Generated .IDL file (by the OLE/COM Object Viewer)
// 
// typelib filename: AccessParam.tlb

[
  uuid(C24F6EAB-4957-34BB-8008-CCABAF1E8B36),
  version(6.0),
  custom(90883F05-3D28-11D2-8F17-00A0C9A6186D, "AccessParam, Version=6.0.5.0, Culture=neutral, PublicKeyToken=null")

]
library AccessParam
{
    // TLib :     // TLib : mscorlib.dll : {BED7F4EA-1A96-11D2-8F08-00A0C9A6186D}
    importlib("mscorlib.tlb");
    // TLib : Esri System Object Library 10.1 : {5E1F7BC3-67C5-4AEE-8EC6-C4B73AAC42ED}
    importlib("esriSystem.olb");
    // TLib : OLE Automation : {00020430-0000-0000-C000-000000000046}
    importlib("stdole2.tlb");

    // Forward declare all types defined in this typelib
    interface _AccessParameter;
    interface _ManageParameter;

    [
      uuid(388AB2D9-A3A3-3400-8644-F0A3BA43F621),
      version(1.0),
      custom(0F21F359-AB84-41E8-9A78-36D110E6D2F9, "AccessParam.AccessParameter")
    ]
    coclass AccessParameter {
        interface _Object;
        [default] interface _AccessParameter;
    };

    typedef [uuid(B59B449B-2757-3E69-A39A-4535A59CD173), version(1.0)    ,
      custom(0F21F359-AB84-41E8-9A78-36D110E6D2F9, "AccessParam.AccessParameter+AzEnumGDBNames")    
]
    enum {
        AzEnumGDBNames_AzGOcadastre = 0,
        AzEnumGDBNames_AzGOhistorique = 1,
        AzEnumGDBNames_AzGOtravail = 2,
        AzEnumGDBNames_AzGOmatrice = 3,
        AzEnumGDBNames_AzGOmatriceHab = 4,
        AzEnumGDBNames_AzGOmatriceHis = 5
    } AzEnumGDBNames;

    typedef [uuid(94C28066-95C8-3380-A46A-DFECD219E900), version(1.0)    ,
      custom(0F21F359-AB84-41E8-9A78-36D110E6D2F9, "AccessParam.AccessParameter+AzEnumParameters")    
]
    enum {
        AzEnumParameters_AzConnection = 0,
        AzEnumParameters_AzFuseau = 1,
        AzEnumParameters_AzRepPrinc = 2,
        AzEnumParameters_AzSuffixeGDB = 3,
        AzEnumParameters_AzListMuni = 4,
        AzEnumParameters_AzRepGDB = 5,
        AzEnumParameters_AzRepDataMRN = 6,
        AzEnumParameters_AzRepRapport = 7,
        AzEnumParameters_AzRepRoleFoncier = 8,
        AzEnumParameters_AzRepMatriceScan = 9,
        AzEnumParameters_AzRepArchives = 10
    } AzEnumParameters;

    [
      odl,
      uuid(3CEEDD8D-2A91-3BCB-A620-1D818994EF47),
      version(1.0),
      dual,
      oleautomation,
      custom(0F21F359-AB84-41E8-9A78-36D110E6D2F9, "AccessParam.AccessParameter+_AccessParameter")    

    ]
    interface _AccessParameter : IDispatch {
        [id(0x00000001), propget]
        HRESULT NomTerritoire([out, retval] BSTR* pRetVal);
        [id(0x00000001), propput]
        HRESULT NomTerritoire([in] BSTR pRetVal);
        [id(0x00000002), propget]
        HRESULT AliasTerritoire([out, retval] BSTR* pRetVal);
        [id(0x00000002), propput]
        HRESULT AliasTerritoire([in] BSTR pRetVal);
        [id(0x00000003), propget]
        HRESULT NomAppli([out, retval] BSTR* pRetVal);
        [id(0x00000003), propput]
        HRESULT NomAppli([in] BSTR pRetVal);
        [id(0x00000004), propget]
        HRESULT DateCreate([out, retval] DATE* pRetVal);
        [id(0x00000004), propput]
        HRESULT DateCreate([in] DATE pRetVal);
        [id(0x00000005), propget]
        HRESULT CountParam([out, retval] short* pRetVal);
        [id(0x00000006), propget]
        HRESULT ToCreate([out, retval] VARIANT_BOOL* pRetVal);
        [id(0x00000006), propput]
        HRESULT ToCreate([in] VARIANT_BOOL pRetVal);
        [id(0x00000007), propget]
        HRESULT CodeParam(
                        [in] short Index, 
                        [out, retval] AzEnumParameters* pRetVal);
        [id(0x00000007), propput]
        HRESULT CodeParam(
                        [in] short Index, 
                        [in] AzEnumParameters pRetVal);
        [id(0x00000008), propget]
        HRESULT ValueParam(
                        [in] AzEnumParameters EnumP, 
                        [out, retval] BSTR* pRetVal);
        [id(0x00000008), propput]
        HRESULT ValueParam(
                        [in] AzEnumParameters EnumP, 
                        [in] BSTR pRetVal);
        [id(0x00000009), propget]
        HRESULT DescripParam(
                        [in] AzEnumParameters EnumP, 
                        [out, retval] BSTR* pRetVal);
        [id(0x00000009), propput]
        HRESULT DescripParam(
                        [in] AzEnumParameters EnumP, 
                        [in] BSTR pRetVal);
        [id(0x0000000a), propget]
        HRESULT EstModifParam(
                        [in] AzEnumParameters EnumP, 
                        [out, retval] VARIANT_BOOL* pRetVal);
        [id(0x0000000a), propput]
        HRESULT EstModifParam(
                        [in] AzEnumParameters EnumP, 
                        [in] VARIANT_BOOL pRetVal);
        [id(0x0000000b), propget]
        HRESULT GetPropertyConnect(
                        [in] AzEnumGDBNames GDB, 
                        [out, retval] IPropertySet** pRetVal);
        [id(0x0000000c), propget]
        HRESULT NameGDB(
                        [in] AzEnumGDBNames EnumGDB, 
                        [out, retval] BSTR* pRetVal);
    };

    [
      uuid(25E50774-0A09-3C1B-A7DA-FBFE54CBFBC9),
      version(1.0),
      custom(0F21F359-AB84-41E8-9A78-36D110E6D2F9, "AccessParam.ManageParameter")
    ]
    coclass ManageParameter {
        interface _Object;
        [default] interface _ManageParameter;
    };

    typedef [uuid(5ED0622E-5DC6-3DF6-A568-57DF774744F1), version(1.0)    ,
      custom(0F21F359-AB84-41E8-9A78-36D110E6D2F9, "AccessParam.ManageParameter+AzEnumAppNames")    
]
    enum {
        AzEnumAppNames_AzAppGOcadastre = 0,
        AzEnumAppNames_AzAppGOmatrice = 1
    } AzEnumAppNames;

    [
      odl,
      uuid(7D8D41B4-EF0A-370B-86BB-163F1A27B568),
      version(1.0),
      dual,
      oleautomation,
      custom(0F21F359-AB84-41E8-9A78-36D110E6D2F9, "AccessParam.ManageParameter+_ManageParameter")    

    ]
    interface _ManageParameter : IDispatch {
        [id(0x00000001), propget]
        HRESULT LoadParam(
                        [in, optional, defaultvalue(<unprintable IUnknown*>)] VARIANT Index, 
                        [in, optional, defaultvalue(0)] AzEnumAppNames GOapp, 
                        [out, retval] _AccessParameter** pRetVal);
        [id(0x00000002), propget]
        HRESULT LoadParamDefault(
                        [in] BSTR NomApp, 
                        [out, retval] _AccessParameter** pRetVal);
        [id(0x00000003), propget]
        HRESULT GetParamMuni(
                        [in] short Index, 
                        [out, retval] _AccessParameter** pRetVal);
        [id(0x00000004), propget]
        HRESULT Count([out, retval] short* pRetVal);
        [id(0x00000005)]
        HRESULT AddTerritoire([in] _AccessParameter* Param);
        [id(0x00000006)]
        HRESULT SuppTerritoire(
                        [in, out] BSTR* Terr, 
                        [in, out] BSTR* Appli);
        [id(0x00000007)]
        HRESULT UpdateAllMuni();
        [id(0x00000008)]
        HRESULT UpdateMuni([in, out] short* Index);
    };
};
4

1 回答 1

1

发现了问题。在声明中

HRESULT LoadParam(
    [in, optional, defaultvalue(<unprintable IUnknown*>)] VARIANT Index, 
    [in, optional, defaultvalue(0)] AzEnumAppNames GOapp, 
    [out, retval] _AccessParameter** pRetVal);

无法打印的 IUnknown* 导致了错误。我删除了索引字段的默认值声明,一切都编译了。

于 2014-05-06T20:05:37.080 回答