Re: How to change default browser in Mac OS X 10.2?
Re: How to change default browser in Mac OS X 10.2?
- Subject: Re: How to change default browser in Mac OS X 10.2?
- From: Jérome Foucher <email@hidden>
- Date: Tue, 13 May 2003 09:28:53 +0200
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@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.