Delphi XE2:是否有预定义的条件来识别VCL和FireMonkey? [英] Delphi XE2: Is there a predefined conditional to identify VCL and FireMonkey?
本文介绍了Delphi XE2:是否有预定义的条件来识别VCL和FireMonkey?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在Delphi XE2中,我们使用
In Delphi XE2, we have use
{$ifdef Win32}
{$ifdef Win64}
以确定我们所在的平台。
to identify which platform we are in.
有没有可以识别VCL和FMX的预定义条件?
Is there any predefined conditional that may identify VCL and FMX?
推荐答案
正如其他人所说,没有条件指令来确定您的应用程序是VCL或FireMonkey。我认为最可靠的方法来确定你的应用程序是FireMonkey还是VCL正在使用一个函数而不是条件指令。
As others says, there is not a conditional directive to determine if your application is VCL or FireMonkey. I think the most reliable way to determine if your app is FireMonkey or VCL is using a function instead of a conditional directive.
像
Uses
Rtti;
function IsVCLApp:Boolean;
begin
Result:= CompareText(TRttiContext.Create.GetType(TApplication.ClassInfo).QualifiedName,'Vcl.Forms.TApplication')=0;
end;
function IsFireMonkeyApp:Boolean;
begin
Result:= CompareText(TRttiContext.Create.GetType(TApplication.ClassInfo).QualifiedName,'FMX.Forms.TApplication')=0;
end;
这篇关于Delphi XE2:是否有预定义的条件来识别VCL和FireMonkey?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文