When you press the right button in a picture from My Computer , Windows displays a list of installed applications associated with that type of file "OPen with..." how do I get the same list of programs using the WinAPi and creating a function in C ++ language
-
I suggest you search the MSDN site, or perhaps ask there. Interesting question though. – Thomas Matthews Jun 30 '15 at 18:08
2 Answers
MSDN states that "By default, any application registered as a subkey of HKEY_CLASSES_ROOT\Applications
is presented in the Open with dialog box.".
However, two exceptions are listed: A NoOpenWith
subkey (empty REG_SZ
) removes the application from the Open With dialog. A SupportedTypes
key with a list of extensions restricts the application to only matching Open with dialogs.
Note that HKCR
is a virtual hive, formed by merging the relevant parts of HKCU
and HKLM
.

- 173,980
- 10
- 155
- 350
The 'Open With...' menu is located at the registry key: HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts
, from there you can create some functions to retrieve the data. MSDN has a slew of registry functions to get/set values as well as traverse the trees.
As doing this isn't a trivial bit of code (a lot of error checking to be done), and I won't presume to know what your full needs are, I'll leave the implementation to you to try and do first (then come back to SO if you have questions on your implementation).
Hope that can help.

- 1
- 1

- 6,625
- 1
- 30
- 39
-
I'm fairly sure this is incorrect. For instance, it misses the equivalent `HKLM` key. I also suspect that this is not a documented/stable API. – MSalters Jul 01 '15 at 10:07
-
@MSalters `suspect that this is not a documented/stable API` ? What are you referring to exactly? The MSDN API's? – txtechhelp Jul 01 '15 at 16:34
-
Yes, that's the idea. You want an API which is documented in MSDN, but not one for which MSDN says that it will (or might) go away in future Windows versions, or which is marked experimental, etc. – MSalters Jul 02 '15 at 20:48