How to get the names of Net applications ?
21/10/03 10:39
I need to access the names of applications defined by the user for Internet services in System Prefs…
The header file LaunchServices.h describes all what you need to retrieve this kind of information:
Example to retrieve the name of the Web browser:
NSURL *applicationURL = nil;
OSStatus err;
err = LSGetApplicationForURL((CFURLRef)[NSURL URLWithString:@"http:"], kLSRolesAll, NULL, (CFURLRef *)& applicationURL);
Once you have the application URL you can get the file system path with [applicationURL path] and the application name with [[NSFileManager defaultManager] displayNameAtPath:[applicationURL path]];
To retrieve application name for reading mail use @"mailto:", for FTP @"ftp:", news reader @"news:", etc.
Example to retrieve the name of the Web browser:
NSURL *applicationURL = nil;
OSStatus err;
err = LSGetApplicationForURL((CFURLRef)[NSURL URLWithString:@"http:"], kLSRolesAll, NULL, (CFURLRef *)& applicationURL);
Once you have the application URL you can get the file system path with [applicationURL path] and the application name with [[NSFileManager defaultManager] displayNameAtPath:[applicationURL path]];
To retrieve application name for reading mail use @"mailto:", for FTP @"ftp:", news reader @"news:", etc.