anyone know if there’s an api on Windows that, given a file, can return a list of applications that can open it ?
I think that you have to look in the registry:
Maybe this? It uses COM which is out of my wheelhouse, but it looks promising.
Looks darned close except it only provides ONE value from the docs
The association array APIs can be used to retrieve from the registry subkey a single value that contains the requested information, with that value coming from the first entry in the array that provides it.
I’ll keep hunting
edit : @Julian ? any ideas ?
I thought about this a long time ago when I was going to create an opener selector for xojo project types and I never really got stuck into it.
It’s an interesting one, I don’t really see the point in the association arrays, returning mspaint.exe for a .txt file isn’t really much help as it clearly can’t read it but it’s in the OpenWithList under
AssocQueryStringW will only show the default endpoint and that is even hit and miss with .jpg only having and edit entry and not one for open.
Apps tend not to register themselves correctly so the data can be hard/impossible to obtain and if something overwrites a previous install, like a new xojo version for example, then there will be no reference to the previous edition even though it can quite happily open the file.
is where they should be listed (example showing mspaint.exe’s supported types), but the odds of an app actually registering things there are slim to none as companies tend to do the minimum to get their type working.
Application Registration - Win32 apps | Microsoft Docs shows where you need to look.