title: How can I get the Name of the Program associated with a file extension using Delphi?
body: <p>I need to get the name of the program currently associated with a file extension for the current user. If you right-click on a file and select properties, then what I need is the program name that is to the right of the "Opens with" line. </p>
  
  <p>e.g. For ".xls", I want to be able to get the answer "Microsoft Office Excel", or whatever program the user has as their default program to open .xls files.</p>
  
  <p>I have determined it's not as easy as just going into HKEY_CLASSES_ROOT and picking it out, since it may also be specified in HKEY_LOCAL_MACHINE or HKEY_CURRENT_USER or HKEY_USERS. </p>
  
  <p>Maybe all I need to know is the pecking order used by Windows to determine this and how to get to each of the locations. Of course, a Windows API call to do this would be ideal.</p>
  
  <p>This is a similar question to: 
  <a href="https://stackoverflow.com/questions/829843/">How to get icon and description from file extension using Delphi?</a> but that question only answered how to get the description of the extension and the icon of the associated program. I couldn't find a way to extend that to also get the name of the associated program.</p>
  
  <p>I'm using Delphi 2009 and need a solution that works on Windows XP, Vista and 7.</p>
  
  <hr>
  
  <p>Thank you all for your answers.</p>
  
  <p>It appears my belief that the name of the executable is not in the Registry after all. And after looking around extensively for a Windows API that will give the name, I could not find one.</p>
  
  <p>I think Mef's answer then is the best. To get the name of the executable from the information included in the program's executable.</p>
  
  <hr>
  
  <p>Followup:  I found <a href="https://stackoverflow.com/a/16941705/30176">David Hefferman's answer to "How do I open a file with the default text editor?"</a> gives an excellent solution for opening one program using the default program for a different extension.</p>