0

我正在尝试使用 LSCopyAllHandlersForURLScheme 函数来枚举 Mac OS X 下已安装的 Web 浏览器,以我的方式,我正在检查 Delphi RTL 中包含的 Macapi.CoreServices 文件,我发现并非所有包含文件都实际存在,它们看起来像评论而不是 $I 包含指令,我错过了什么吗?这是代码

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.
4

1 回答 1

0

我现在自己导入了这个函数,这里是如何做到的(真的很容易):

const launchServicesLib = '/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/LaunchServices';
function LSCopyAllHandlersForURLScheme(inURLScheme: CFStringRef) : CFArrayRef; cdecl; external launchServicesLib name '_LSCopyAllHandlersForURLScheme';

我不知道为什么 Embarcadero 没有实现 LaunchServices!

谢谢,

于 2015-09-16T11:50:42.713 回答