Delphi Macapi.CoreServices缺少LaunchServices
问题描述:
我试图使用LSCopyAllHandlersForURLScheme函数在Mac OS X下通过已安装的Web浏览器枚举,按照我的方式,我正在检查包含在Delphi RTL中的Macapi.CoreServices文件,而我发现并不是所有的包含文件实际上都存在,它们看起来像是注释而不是$ I include指令,我错过了什么吗?下面是代码Delphi Macapi.CoreServices缺少LaunchServices
unit Macapi.CoreServices;
{$WEAKPACKAGEUNIT}
interface
{$I OSTypes.inc}
{$I MacTypes.inc}
{$I TextCommon.inc}
{$I Files.inc}
{$I DispatchSemaphores.inc}
{$I MacErrors.inc}
{$IFNDEF IOS}
{$I Multiprocessing.inc}
{$I DriverServices.inc}
{$I Gestalt.inc}
{$ENDIF !IOS}
{ $I OSServices.inc}
{ $I SFNetwork.inc}
{ $I LaunchServices.inc}
{ $I SearchKit.inc}
{ $I Metadata.inc}
{ $I DictionaryServices.inc}
{ $I AE.inc}
const
CoreServicesLib = '/System/Library/Frameworks/CoreServices.framework/CoreServices';
{$EXTERNALSYM CoreServicesLib}
CarbonCoreLib = '/System/Library/Frameworks/CoreServices.framework/Frameworks/CarbonCore.framework/CarbonCore';
{$EXTERNALSYM CarbonCoreLib}
implementation
{$IF NOT DECLARED(_PU)}
const
{$IFDEF UNDERSCOREIMPORTNAME}
_PU = '_';
{$ELSE}
_PU = '';
{$ENDIF}
{$ENDIF}
{$I MacTypesImpl.inc}
{ $I TextCommonImpl.inc}
{$I FilesImpl.inc}
{$I DispatchSemaphoresImpl.inc}
{$IFNDEF IOS}
{$I MultiprocessingImpl.inc}
{$I DriverServicesImpl.inc}
{$I GestaltImpl.inc}
{$ENDIF !IOS}
{ $I OSServicesImpl.inc}
{ $I SFNetworkImpl.inc}
{ $I LaunchServicesImpl.inc}
{ $I SearchKitImpl.inc}
{ $I MetadataImpl.inc}
{ $I DictionaryServicesImpl.inc}
{ $I AEImpl.inc}
end.
答
我导入功能我现在,这里是如何做到这一点(很容易):
const launchServicesLib = '/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/LaunchServices';
function LSCopyAllHandlersForURLScheme(inURLScheme: CFStringRef) : CFArrayRef; cdecl; external launchServicesLib name '_LSCopyAllHandlersForURLScheme';
我不知道为什么Embarcadero公司没有实施LaunchServices !
谢谢,