0

I'd like to define a struct in typelib definition language to create a typelib.

So far I have a struct and two interfaces:

typedef [uuid(FD68C55A-A933-4c4a-BD26-A1967ABA6F8F), version(1.0)]
struct tagVerbListEntry {
    [helpstring("Key")]
    BSTR Key;
    [helpstring("Description")]
    BSTR Description;
} VerbListEntry;

[
  odl,
  uuid(2EACD14A-E5B4-4236-A9FC-DEFB01464977),
  version(1.0),
  dual,
  nonextensible,
  oleautomation
]
interface IDesignObject : IDispatch {
    [id(0xfffff447)] HRESULT Activate([in] BSTR pGUID);
    [id(0xfffff446)] HRESULT AddControl([in] BSTR ProgID, [in] float PosX, [in] float PosY, [in] float Width, [in] float Height, [out, retval] long* ret);
    [id(0xfffff445)] HRESULT FormularSize([in, out] float* Width, [in, out] float* Height);
    [id(0x60030001)] HRESULT GetParameter([in] VARIANT ParamType, [out, retval] VARIANT* ret);
    [id(0xfffff444)] HRESULT MouseDown([in, out] short* Button, [in, out] short* Shift, [in, out] float* X, [in, out] float* Y);
    [id(0xfffff441)] HRESULT Move([in] float Left, [in] float Top, [in] float Width, [in] float Height);
    [id(0x68030000), propget] HRESULT Name([out, retval] BSTR* RHS);
    [id(0xfffff440), propget] HRESULT NoFormDesigner([out, retval] boolean* RHS);
    [id(0xfffff43f), propget] HRESULT ParentName([out, retval] BSTR* RHS);
    [id(0xfffff443)] HRESULT MouseMove([in, out] short* Button, [in, out] short* Shift, [in, out] float* X, [in, out] float* Y);
    [id(0xfffff442)] HRESULT MouseUp([in, out] float* Button, [in, out] float* Shift, [in, out] float* X, [in, out] float* Y);
    [id(0xfffff43e)] HRESULT Save();
    [id(0xfffff43c)] HRESULT SetExtendedAttributes([in] long NewAttributes);
    [id(0x60030002)] HRESULT SetParameter([in] VARIANT ParamType, [in, out] VARIANT* ParamValue);
};

[
  odl,
  uuid(4C410B09-B6A7-4754-9BC0-88214F4BE7AC),
  version(1.0),
  dual,
  nonextensible,
  oleautomation
]
interface IDesigner : IDispatch {
    [id(0x60030001)] HRESULT AfterCreate();
    [id(0x60030002)] HRESULT DoVerb([in] BSTR Key, [out, retval] long* Ret);
    [id(0x60030003)] HRESULT GetVerbList([in] BSTR LanguageID, [in, out] SAFEARRAY(VerbListEntry)* VerbList, [out, retval] long* Ret);
    [id(0x60030004)] HRESULT ImportantMembers([out, retval] _Collection** ret);
    [id(0x60030005)] HRESULT ForbiddenBaseElements([out, retval] VARIANT* ret);
    [id(0x68030000), propget] HRESULT DefinitionProperties([out, retval] long* ret);
    [id(0x60030006)] HRESULT SetDesignMode([in, out] IDesignObject** DesignMaster, [out, retval] boolean* ret);
    [id(0x60030007)] HRESULT SetContainerControl([in, out] IDispatch** Container);
    [id(0x60030008)] HRESULT DefinitionRefresh([in, out] IDispatch** F, [in, out] IDispatch** ChildList);
};

But when running the compiler I get the message for line

[id(0x60030003)] HRESULT GetVerbList([in] BSTR LanguageID, [in, out] SAFEARRAY(VerbListEntry)*

fatal error M0001: Syntax error near line xx column 100: Type is not OleAutomation-compatible

This is the line with the use of VerbListEntry. What must be done to make the struct ole-compatible?

Please give me help!

Simon Mourier
  • 132,049
  • 21
  • 248
  • 298
  • Note sure exactly how you get to that error. This file (slightly changed) compiles fine and creates a .tlb with a simple "midl myfile.idl" call https://pastebin.com/raw/UKwhf4U8 – Simon Mourier Jun 15 '23 at 09:33
  • How's your environment making it work? Might be I am too old with my MKTYPLIB.exe? But it compiles all other typelibs well. You are importing wtypes.idl and oaidl.idl. I don't see in these files any reasons for fails in my file. – René Rössler Jun 15 '23 at 09:56
  • mktyplib is a dead old thing. Use midl.exe https://learn.microsoft.com/en-us/windows/win32/midl/using-the-midl-compiler-2 – Simon Mourier Jun 15 '23 at 10:03
  • Maybe you find https://github.com/RenRoe/TypeLib to check? – René Rössler Jun 15 '23 at 10:20
  • Not sure what you mean – Simon Mourier Jun 15 '23 at 16:53
  • Problem is solved. I use MIDL now and it works with structs, where tag name is the struct name. Thank you. MKTYPLIB really seems to old. – René Rössler Jun 23 '23 at 08:15

0 Answers0