I cannot find a solution anywhere to this problem. I've only seen bits and pieces of code that barely work to get some exe files associated in the registry to that particular extension.
What I want is the exact list the Windows Explorer context menu will give you if you go to the Open With item. If I have to do it with p/invoke that is fine, I just want the exact list that explorer would show. That would include the friendly name as well as the path to associated program.
The list I want to retrieve for a pdf:
The list I want to retrieve for a png:
It may be worth noting that Microsoft calls it the "Recommended Programs" if you attempt to choose by clicking "Choose default program..."
So how is that dialog populated? Because it must be using the same method for the Open With context menu.
There are some popular answers to this question on SO, but most of them only half work.
If the AssocQueryString
function returned multiple results it'd be close to an answer, however I believe it can only get the actual program associated with it.