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 */;
Propriétés
Type | Visibilité | Source | Unité | Parent |
---|---|---|---|---|
function | public | FMX.Platform.pas FMX.Platform.hpp |
FMX.Platform | TPlatformServices |
Description
Indique si le service donné est disponible sur la plate-forme sur laquelle s'exécute votre application.
Il existe deux méthodes SupportsPlatformService surchargées. La première n'accepte qu'un paramètre (AServiceGUID
), tandis que la seconde a deux paramètres. Le second est un paramètre de sortie (de type out) qui renvoie le service dont vous voulez vérifier l'existence. Si vous utilisez la deuxième méthode surchargée et que le service que vous spécifiez n'est pas disponible, le paramètre de sortie AService
renvoie nil.
Par exemple, vous pouvez écrire :
var
ScreenService: IFMXScreenService;
ScreenSize: TPoint;
begin
if TPlatformServices.Current.SupportsPlatformService(
IFMXScreenService, IInterface(ScreenService)) then
begin
ScreenSize := ScreenService.GetScreenSize.Round;