Reputation: 4444
I am wondering if it's possible to somehow use ShellExecute to open multiple files at once using the default verb handler. For example, if I have multiple mp3 files in a folder, I can select all of them, then right click and select "Play". This will bring up one instance of WMP (which is my default mp3 player) and will add all of the files I selected to the current playlist.
1) Is this accomplished using some standardized ShellExecute behavior?
2) Or is this done by first determining what the default program is and then supplying the list of files as arguments to that executable?
My goal is to be able to take a list of files and open them using the default verb with the default program (ideally without having to dig through the registry first).
I.e. the equivalent of this, but for multiple files:
ShellExecute(NULL, NULL, the_file_to_open, NULL, NULL, SW_SHOWNORMAL);
Upvotes: 2
Views: 1233
Reputation: 37202
No, ShellExecute
can't do this. Instead, the way to do it is with IContextMenu
.
Broadly speaking:
SHBindToObject
IShellFolder::GetUIObjectOf
IContextMenu::QueryContextMenu
, passing the CMF_DEFAULTONLY
flagIContextMenu::InvokeCommand
Upvotes: 8