delphi - delphi中如何导入接口(interface)?

标签 delphi interface

我想从 Windows 库获取文件夹路径(例如: Libraries\Documents )。我发现需要使用IShellLibrary interface但我找不到在 ShlObj (Delphi 2009 x64 win7) 中声明。我想知道如何将此接口(interface)导入到我的代码中? enter image description here

最佳答案

如果您无法使用包含此接口(interface)的现代 Delphi,则需要从 Windows 头文件(在本例中为 Shobjidl.h)转换该接口(interface)。在 Delphi 中它是这样开始的:

IShellLibrary = interface(IUnknown) 
  ['{11A66EFA-382E-451A-9234-1E0E12EF3085}']
  ....
end;

GUID 可以在头文件中找到。然后您需要添加功能。必须按照头文件中声明的顺序添加它们。这些函数都应该声明为 stdcall

我不想发布 XE3 源代码的整个接口(interface)声明,因为我认为这是侵犯版权的行为。

也许如果您足够努力地搜索,您可能会在网络上的某个地方找到这段代码。事实上,我刚刚找到了它:http://mustangpeakcommonlib.googlecode.com/svn-history/r12/trunk/Source/MPShellTypes.pas

关于delphi - delphi中如何导入接口(interface)?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13487056/

相关文章:

.net - 使用标记接口(interface)而不是属性的令人信服的理由

xml - 从 Delphi 7 使用 XML

c++ - 在主应用程序中声明的 dll 中实现接口(interface) - C++

c# - 如何在 AutoFac 中注册具有接口(interface)类型的通用接口(interface)?

delphi - 解析文件和文件夹的备忘录

c# - 是否可以将接口(interface)作为松散耦合的参数

c - 如何提供一致的接口(interface): Deep-Copy OpenSSL structs or Document Distinct Cases?

delphi - 如何声明基于泛型类型的指针?

delphi - 如何避免 ftFmtBcd 失去精度?

delphi - 从 INI 文件更改 DataSnap 服务器端口