I need to get the name of the program that is currently associated with the file extension for the current user. If you right-click on a file and select properties, then I need the name of the program, which is located to the right of the line "Opens with".
eg. For ".xls" I want to get the answer "Microsoft Office Excel" or any other program that the user has as his default program to open .xls files.
I defined it is not so simple as going to HKEY_CLASSES_ROOT and picking it up, since it can also be specified in HKEY_LOCAL_MACHINE or HKEY_CURRENT_USER or HKEY_USERS.
Perhaps all I need to know is the hierarchy order used by Windows to determine this and how to get to each place. Of course, calling the Windows API for this would be ideal.
This is a similar question: How to get the icon and description from a file extension using Delphi? , but this question only answered how to get the description of the extension and the icon of the corresponding program. I could not find a way to extend this to get the name of the related program.
I am using Delphi 2009 and need a solution that works on Windows XP, Vista and 7.
Thank you all for your answers.
Looks like I suppose the executable file name is not in the registry. And, having carefully examined the Windows API, which will give a name, I could not find it.
I think Mef's answer is then the best. To get the name of the executable file from the information included in the executable file of the program.
windows file-type delphi registry file-association
lkessler
source share