Show: Delphi C++
Display Preferences

FMX.Platform.TPlatformServices.SupportsPlatformService

From RAD Studio API Documentation
Jump to: navigation, search

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 */;

Properties

Type Visibility Source Unit Parent
function public
FMX.Platform.pas
FMX.Platform.hpp
FMX.Platform TPlatformServices

Description

Returns whether the given service is available on the platform your application is running on.

There are two SupportsPlatformService overloaded methods. The first one accepts only one parameter (AServiceGUID), while the second one has two parameters, the second parameter is an output (out) parameter that returns the service you test for existence. If you use the second overloaded method and the service you specify is not available, then the AService output parameter returns nil.

For example, you can write:

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>(""));
}
Note: Please consider that you need to add & before Intf, as you can see in the code sample above.


See Also

Personal tools
In Other Languages
Previous Versions
Assistance