【问题标题】:Using records as property types in Delphi COM Wizard在 Delphi COM 向导中使用记录作为属性类型
【发布时间】:2010-06-27 08:20:59
【问题描述】:

我正在尝试设计一个使用属性返回记录的 COM 库。 Delphi COM 向导允许我创建属性,但是当它被编译时,我得到了

[GENTLB Error] Project1.ridl(1): Error saving C:\Users\mark\Documents\RAD Studio\Projects\Test\Project1.tlb: Inconsistent property functions

生成的 RIDL 文件如下所示...

[
 uuid(24BD89DB-AB22-430C-874C-EC5CEA062E80)
]   
struct Record1   
{
    long Field1;   
};


[
  uuid(FA48C31A-56B8-4A86-8325-5A2000AA77B2),
  helpstring("Interface for XXX Object"),
  oleautomation
]
interface IXXX : IUnknown
{
  [propget, id(0x00000065)]
  HRESULT _stdcall Property1([out, retval] struct Record1* Value);
  [propput, id(0x00000065)]
  struct Record1 _stdcall Property1([in] long Value);
};

谁能看到我在这里做错了什么?

【问题讨论】:

    标签: delphi typelib


    【解决方案1】:

    “propput”部分应如下所示:

    [propput, id(0x00000065)]
    HRESULT _stdcall Property1([in] struct Record1 Value);
    

    【讨论】:

    • 谢谢,它确实解决了这个问题,唯一的问题是我一开始并没有像 COM 向导那样创建 RIDL。我会试着重复一遍,看看出了什么问题。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2010-10-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多