Archives Links Register Bookmarks
SEARCH:
COCOADEV
How to change default browser in Mac OS X 10.2?

Back to main list
Note: I am currently working on improving the cocoa mailing list archive and moving it to another domain. The current archive is taking a lot of resources on my server, as well as a lot of bandwidth and I have to pay for that. Out of the 60 000 visits I get each months, only a very small number of people made a donation to support this project. I know that developers in (very) big companies are using this website quite often, none of them ever made a donation... Donations were made by small companies or individuals. Anyway, if you ever thought about making a donation, because you find this site a useful resource or because you use it often, I think it is time to do it now as I need some motivation.
Translate:   Prev | Next

Re: How to change default browser in Mac OS X 10.2?
FROM: Jérome Foucher
DATE: 2003-05-13 09:28

On mardi, mai 13, 2003, at 04:32 Europe/Paris, Noriaki Misawa wrote:

> Hello.
>
> I have a question.
>
> I want to change default browser while launch my application.
> Who does anybody know documents or sample or etc...?
>
> Using Project Buider, Interface Builder, Cocoa.
>
> My code is
>
> #define kICDefaultBrowser    "(J\(BpHelper(I%(Bhttp"
>
> ICInstance theInst;
> OSStatus status = ICStart( &theInst, 0 );
> Size size = sizeof( OSType );
> ICAttr attr = kICAttrNoChange;
> status = ICSetPref( theInst, kICDefaultBrowser, attr,
> (OSType*)&creator, size ); <- Error!
> status = ICStop( theInst );

It's not a creator type you have to pass to ICSetPref but an ICAppSpec
structure (definied in InternetConfig.h)

So you code should look like :

ICInstance    theInst;
ICAppSpec    browserSpec;
Size            size;
OSStatus        status;

status = ICStart(&theInst, 0);

browserSpec.fCreator = creator;
memcpy(browserSpec.name, pascal_name, pascal_name[0]+1);
size = sizeof(ICAppSpec);
status = ICSetPref(theInst, kICDefaultBrowser, attr, &browserSpec,
size);

status = ICStop(theInst);

Where "creator" is the OSType of the browser and "pascal_name" is the
name of the browser as a Str255 (it MUST include the .app suffix if the
browser is a package !).

Hope this helps,
Jerome
_______________________________________________
cocoa-dev mailing list | <EMAIL REMOVED>
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
 


Thread/Subject Author Date/Time
How to change default browser in Mac OS X 10.2? Noriaki Misawa 2003-05-13 04:32
Re: How to change default browser in Mac OS X 10.2? Jérome Foucher 2003-05-13 09:28
Re: How to change default browser in Mac OS X 10.2? M. Uli Kusterer 2003-05-13 15:27
     

© 2002 mamasam - All rights reserved
Feedback - Donations - RSS