FROM : Steve Dekorte
DATE : Sun Jan 26 23:39:06 2003
On Sunday, January 26, 2003, at 10:59 PM, Steve Dekorte wrote:
> Vince DeMarco wrote:
>> Steve Dekorte wrote:
>>> How can I programmatically find which web browser is set to be the
>>> default in the System/Internet preferences?
>> look up the function LSGetApplicationForURL()
> Thanks for the response. Should this code work?:
Found the problem - the file has to be present. This works:
{
char *URL =
"file:///System/Library/Frameworks/AppKit.framework/Versions/C/
Resources/English.lproj/Documentation/Reference/ObjC_classic/
AppKitTOC.html";
FSRef appRef;
CFURLRef appURL;
CFStringRef urlStr = CFStringCreateWithCString(NULL, URL,
kCFStringEncodingASCII);
CFURLRef inURL = CFURLCreateWithString(NULL, urlStr, NULL);
OSStatus oss = LSGetApplicationForURL(inURL, kLSRolesEditor,
&appRef, &appURL);
CFStringRef s = CFURLGetString(appURL);
printf("default web browser = %s\n", [[(NSString *)s
lastPathComponent] cString]);
}
Cheers,
Steve
OSX freeware and shareware: http://www.dekorte.com/downloads.html
DATE : Sun Jan 26 23:39:06 2003
On Sunday, January 26, 2003, at 10:59 PM, Steve Dekorte wrote:
> Vince DeMarco wrote:
>> Steve Dekorte wrote:
>>> How can I programmatically find which web browser is set to be the
>>> default in the System/Internet preferences?
>> look up the function LSGetApplicationForURL()
> Thanks for the response. Should this code work?:
Found the problem - the file has to be present. This works:
{
char *URL =
"file:///System/Library/Frameworks/AppKit.framework/Versions/C/
Resources/English.lproj/Documentation/Reference/ObjC_classic/
AppKitTOC.html";
FSRef appRef;
CFURLRef appURL;
CFStringRef urlStr = CFStringCreateWithCString(NULL, URL,
kCFStringEncodingASCII);
CFURLRef inURL = CFURLCreateWithString(NULL, urlStr, NULL);
OSStatus oss = LSGetApplicationForURL(inURL, kLSRolesEditor,
&appRef, &appURL);
CFStringRef s = CFURLGetString(appURL);
printf("default web browser = %s\n", [[(NSString *)s
lastPathComponent] cString]);
}
Cheers,
Steve
OSX freeware and shareware: http://www.dekorte.com/downloads.html
| Related mails | Author | Date |
|---|---|---|
| Steve Dekorte | Jan 26, 21:28 | |
| Vince DeMarco | Jan 26, 22:11 | |
| Steve Dekorte | Jan 26, 23:03 | |
| Steve Dekorte | Jan 26, 23:39 | |
| Steve Dekorte | Jan 27, 00:00 | |
| Nick Zitzmann | Jan 27, 04:08 | |
| Vince DeMarco | Jan 27, 08:26 | |
| Jérôme Seydoux | Feb 3, 06:00 |






Cocoa mail archive

