How do I launch the Select Application dialog on Mac?
I use LSOpenItemsWithRole()
to open any file from my application. It works fine for all files that have a default application on Mac, but for files that cannot be opened with the default application, this method returns an error kLSApplicationNotFoundErr
and does nothing.
In such cases, I want my application to launch the Select Application dialog so that end users can select any application from there to open the file. This dialog box appears when any such file is opened directly by double-clicking. Is there any direct API call to do the same?
I don't want to use an Objective C call, is there a way to do this using Carbon API calls?
a source to share
You have to use NSOpenPanel
by running the user in the Applications and the delegate method panel:shouldEnableURL:
to filter paths that do not end in .app. You can use setAccessoryView:
to add any custom parameters to the dialog. This is what the Finder does when you click "Other ..." when choosing which application to use.
a source to share
I think you can do this using NavCreateChooseFileDialog, with NavCustomControl to set start location and NavDialogSetFilterTypeIdentifiers to filter outside of apps. (Why don't you want to use Objective-C? You know that you can mix Carbon and Cocoa in the same application, right?)
a source to share