是否可以使用RTTI在接口上获取GUID的值? [英] Is it possible to get the value of a GUID on an interface using RTTI?

查看:50
本文介绍了是否可以使用RTTI在接口上获取GUID的值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我有一个界面,例如:

If I have an interface such as:

IPluginAPI = interface
['{590DFF0B-CA00-46CC-84B0-3848103D4C5A}']
   function add (a : double; b : double) : double;
   function sub (a : double; b : double) : double;
   function mult (a : double; b : double) : double;
   function divide (a : double; b : double) : double;
end;

是否有使用RTTI获取GUID的值?我正在使用Delphi XE.

Is there anyway to get the value of the GUID using RTTI? I am using Delphi XE.

推荐答案

uses
  TypInfo;

Guid := GetTypeData(TypeInfo(IPluginAPI))^.Guid;

这篇关于是否可以使用RTTI在接口上获取GUID的值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆