OpenTools API를 통해 Delphi 프로젝트에 대상 플랫폼을 추가하는 방법
-
21-12-2019 - |
문제
델파이 (XE2 ~ XE5)에서 프로젝트에 대상 플랫폼을 프로그래밍 방식으로 추가 할 수 있습니까?
"프로그래밍 방식으로", 나는 .dproj 파일의 변환과는 대조적으로 OpenTools API를 통해 의미합니다.이것은 IDE 마법사 / 전문가 내에서 수행됩니다.
저는 ToolsAPI 유닛을 보았으며 활성 플랫폼을 얻을 수 있고 지원되는 플랫폼 목록을 얻을 수 있지만 새 대상 플랫폼을 추가하는 데는 아무 것도 없습니다.
해결책
이것이 가능하다는 것 같습니다.보이는 장치는 PlatformAPI
입니다.필요한 내용이있는 인터페이스는 다음과 같습니다.
{ Provides information on platform-specific information held by a project }
IOTAProjectPlatforms160 = interface(IInterface)
['{E1C62726-BD51-4D4E-A2F2-9A8A59F272AE}']
{ Add an available platform to the project }
procedure AddPlatform(const PlatformName: string);
{ Return the currently active platform key }
function CurrentPlatform: string;
{ Return enabled state of the requested platform }
function GetEnabled(const PlatformName: string): Boolean;
{ Return an array of strings representing the enabled platforms for a project }
function GetEnabledPlatforms: TArray<string>;
{ Return the profile name associated with the specified platform }
function GetProfile(const PlatformName: string): string;
{ Does the project support platform specified by PlatformName? }
function GetSupported(const PlatformName: string): Boolean;
{ Return an array of strings representing the valid platforms for a project }
function GetSupportedPlatforms: TArray<string>;
{ Set a platform as disabled for this project (cannot be made active) }
procedure SetEnabled(const PlatformName: string; Value: Boolean);
{ Set the profile name for the specified platform. Pass an empty string to
clear the profile }
procedure SetProfile(const PlatformName, ProfileName: string);
{ Indicate the specified platform is supported or not }
procedure SetSupported(const PlatformName: string; Value: Boolean);
{ Return whether or not the profile associated with PlatformName is the default profile
for that platform }
function UsingDefaultProfile(const PlatformName: string): Boolean;
property EnabledPlatforms: TArray<string> read GetEnabledPlatforms;
property Enabled[const PlatformName: string]: Boolean read GetEnabled write SetEnabled;
property Profile[const PlatformName: string]: string read GetProfile write SetProfile;
property Supported[const PlatformName: string]: Boolean read GetSupported write SetSupported;
property SupportedPlatforms: TArray<string> read GetSupportedPlatforms;
end;
.
AddPlatform
메소드가 당신의 사람으로 나타납니다.
메소드를 호출하려고 시도하지 않았습니다.실제로 도구 API 소스 폴더에서 플랫폼 이라는 단어를 검색했습니다.
제휴하지 않습니다 StackOverflow