tags:

views:

112

answers:

3

Hi All,

I am using LSOpenItemsWithRole() to open any file from my appication. It works fine for all files which has a default application to get opened on Mac, but for the files which cannot be open with any default application this method returns an error kLSApplicationNotFoundErr and does nothing.

For such cases I want my application to launch the "Choose Application" dialog box, so that end user can choose any application from there to open the file. This dialog box pops up whenever any such file is directly opened by double clickig. Is there is any direct API call to do the same?

any help will be appreciated, Thanks in advance!

Manish

+1  A: 

You should use an NSOpenPanel, starting the user in the Applications folder use and the panel:shouldEnableURL: delegate method to filter out paths that don't end in .app. You can use setAccessoryView: to add any custom options to the dialog. This is what the Finder is doing when you click on the "Other..." option when selecting which application to use.

Ken Aspeslagh
A: 

Thanks Ken for you quick reply,

I don't want to us Objective C call, is there is any way to do it using Carbon API calls?

Manish

Manish
This should be a comment - not an answer
Paul R
+1  A: 

I think you can do it by using NavCreateChooseFileDialog, with NavCustomControl to set the initial location and NavDialogSetFilterTypeIdentifiers to filter out non-apps. (Why don't you want to use Objective-C? You know that you can mix Carbon and Cocoa in one app, right?)

JWWalker