FMX.Platform.TPlatformServices.SupportsPlatformService
Delphi
function SupportsPlatformService(const AServiceGUID: TGUID): Boolean; overload;
function SupportsPlatformService(const AServiceGUID: TGUID; out AService): Boolean; overload;
C++
bool __fastcall SupportsPlatformService(const GUID &AServiceGUID)/* overload */;
bool __fastcall SupportsPlatformService(const GUID &AServiceGUID, /* out */ void *AService)/* overload */;
プロパティ
種類 | 可視性 | ソース | ユニット | 親 |
---|---|---|---|---|
function | public | FMX.Platform.pas FMX.Platform.hpp |
FMX.Platform | TPlatformServices |
説明
指定されたサービスが、自分のアプリケーションが稼働しているプラットフォーム上で利用可能かどうかを返します。
SupportsPlatformService にはオーバーロード メソッドが 2 つあります。 最初のメソッドはパラメータを 1 つだけ(AServiceGUID
)取り、2 つのメソッドはパラメータを 2 つ取り、そのうちの 2 番目のパラメータは出力(out)パラメータで、存在を確認するサービスを返します。 2 つ目のオーバーロード メソッドを使用し、指定したサービスが存在しなかった場合、AService
出力パラメータは、nil を返します。
たとえば、次のように記述できます。
var
ScreenService: IFMXScreenService;
ScreenSize: TPoint;
begin
if TPlatformServices.Current.SupportsPlatformService(
IFMXScreenService, IInterface(ScreenService)) then
begin
ScreenSize := ScreenService.GetScreenSize.Round;