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 */;
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:
var
ScreenService: IFMXScreenService;
ScreenSize: TPoint;
begin
if TPlatformServices.Current.SupportsPlatformService(
IFMXScreenService, IInterface(ScreenService)) then
begin
ScreenSize := ScreenService.GetScreenSize.Round;