FMX.Platform.TPlatformServices.SupportsPlatformService

提供: RAD Studio API Documentation
移動先: 案内検索

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メソッドは、パラメータを1つ(AServiceGUID)のみ受け取り、第2メソッドはパラメータが2つあり、2番目のパラメータは存在を確認するサービスを返す出力(out)パラメータとなります。2 番目のオーバーロード メソッドを使用する場合、そして、指定するサービスが利用不可だった場合、AService 出力パラメータは nil を返します。

たとえば、次のように記述できます:

Delphi

var
  ScreenService: IFMXScreenService;
  ScreenSize: TPoint;
begin
  if TPlatformServices.Current.SupportsPlatformService(
       IFMXScreenService, IInterface(ScreenService)) then
  begin
    ScreenSize := ScreenService.GetScreenSize.Round;

C++

_di_IFMXClipboardService Intf;
if (TPlatformServices::Current->SupportsPlatformService(__uuidof(IFMXClipboardService), &Intf))
{
  Intf->SetClipboard(TValue::From<String>(""));
}
メモ: 上記のコード サンプルのように、&Intf の前に追加する必要がある点に留意してください。


関連項目