[futurebasic] Re: [FB] [Cocoa] Quickie URL Launcher

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : July 2009 : Group Archive : Group : All Groups

From: Robert Purves <listrp@...>
Date: Fri, 17 Jul 2009 16:43:25 +1200
Ken Shmidheiser wrote:

> // Requires FBtoC's Objective-C compiler preference
> #if def _PASSTHROUGHFUNCTION
> #import <Cocoa/Cocoa.h>
> void LaunchURL( CFStringRef url ){
> NSAutoreleasePool *localPool =
> [[NSAutoreleasePool alloc] init];
> [[NSWorkspace sharedWorkspace] openURL:
> [NSURL URLWithString:url]];
> [localPool release];
> }
> #endif
> toolbox LaunchURL( CFStringRef )
> call LaunchURL( fn CFSTR( "http://4toc.com/fb/index.htm" ) )
> do
> HandleEvents
> until (gFBQuit )

or there's the Carbon way, not requiring FBtoC's Objective-C compiler  
preference:

include "Tlbx LSOpen.incl"
dim as CFURLRef  url
url = fn CFURLCreateWithString( _kCFAllocatorDefault, fn CFSTR( "http://4toc.com/fb/index.htm 
" ), 0 )
fn LSOpenCFURLRef( url, #0 )
CFRelease( url )

Robert P.