Carbon Code To Open URLs On WxMac
From WxWiki
[edit] Carbon Code To Open URLs On WxMac
(Credits to Aj Lavin)
#ifdef __WXMAC__
#include <Carbon/Carbon.h>
#endif
bool openUrl( const wxString& url)
{
#if defined( __WXMAC__)
ICInstance icInstance;
OSType psiSignature = '????';
OSStatus error = ICStart( & icInstance, psiSignature );
if ( error != noErr )
{
return false;
}
ConstStr255Param hint = 0;
long length = url.Length();
long start = 0;
long end = length;
ICLaunchURL( icInstance, hint, url.c_str(), length, & start, & end);
ICStop( icInstance );
return true;
#else
// *** Put your favorite wxMSW and wxGTK implementations here.
#error
return false; // Not implemented
#endif
}
(Note thanks to Stefan Csomor)
and if you need it to work on non-carbon target, you may have to add
#if !TARGET_CARBON
err = ICFindConfigFile(icInstance, 0, nil);
#endif
in front of the ICLaunchUrl
(Documentation)
IC=Internet Control Panel.
See http://developer.apple.com/qa/nw/nw60.html and http://www.quinn.echidna.id.au/Quinn/Config/ for full documentation (under Programmer documents)
