PDA

View Full Version : Invoking "Choose Application" application launcher from native OS



a3matrix
13th August 2011, 03:35
Is there a way to invoke the "Choose Application" dialog / application launcher from the native OS?

e.g. in Windows the Open With dialog allows the user to pick which application to open a selected file with, and presents a list of apps which were previously associated with that file extension

http://i53.tinypic.com/263vuoo.jpg

I realize QProcess is used for calling arbitrary applications but I'm looking for a more simplistic solution that leverages the native OS' built-in mechanism for handling the opening of various file extensions

Santosh Reddy
13th August 2011, 03:52
I don't think Qt supports this feature yet.
You can try using the native command line options i.e, run "RUNDLL32.EXE SHELL32.DLL,OpenAs_RunDLL <myfile.ext>" using QProcess, it should open a open with dialog

Edit: By the way did you try, bool QDesktopServices:: openUrl ( const QUrl & url );

xtal256
13th August 2011, 11:40
Even if Qt can't do it, i think you can do it with the Windows API. I think you can call ShellExecuteEx with the "openas" verb, and that will show the dialog you want. Although, i think that only works with Windows 7 (or Vista). As far as i know, there is no way of programmatically showing that dialog in XP.

a3matrix
14th August 2011, 20:06
I don't think Qt supports this feature yet.
You can try using the native command line options i.e, run "RUNDLL32.EXE SHELL32.DLL,OpenAs_RunDLL <myfile.ext>" using QProcess, it should open a open with dialog

Edit: By the way did you try, bool QDesktopServices:: openUrl ( const QUrl & url );

I do have another context menu option named "Open" which uses the openUrl (this context menu item simply opens the file with the default associated app) but I was hoping for the "Choose Application" dialog for a separated related context menu item