title: Detecting if Office 365 is installed
body: <p>I need to detect programmatically if Microsoft Excel 2016 (normal Office flavor) or Microsoft Excel (Office 365 flavor) is installed.</p>
  
  <p>Detecting Microsoft Excel 2016 (normal Office flavor) is no problem it works fine, but detecting Excel Office 365 is a bit more trickier.</p>
  
  <p>What I do now:</p>
  
  <ul>
  <li>I check if the registry key <code>HKEY_CLASSES_ROOT\.xlsmm\OpenWithProgids</code></li>
  <li>then I enumerate the values in that key (usually there is only one value of the form <code>"AppXdns5t4sbk...."</code>)</li>
  <li>for each of these values I open the "HKEY_CLASSES_ROOT\\Application" key and I check if the value ApplicationName" is "Excel", and if yes I suppose Excel Office 365 is installed.</li>
  </ul>
  
  <p>This is quite hacky, and if anybody knows a cleaner way, I'd be grateful to learn about it.</p>
  
  <p><strong>Edit:</strong></p>
  
  <p>The reason I need this:</p>
  
  <p>My software allows the user to generate an Excel file (using a 3rd party library) and then view that file in Excel. Once the processing is done and </p>
  
  <ol>
  <li><p>When I simply try to open the .xls file with <code>ShellExecuteEx</code> and Excel is not installed, then the Windows 10 standard "How do you want to open this file" dialog pops up.</p></li>
  <li><p>Even if <code>ShellExecuteEx</code> returned an error message instead of popping up the Windows 10 dialog (as described before), this behaviour is not really what I want, because the generation of the .xls file is pretty long and following would happen: The user executes the command that generates the Excel File, this takes 10 - 15 seconds, and then an error message would pop up saying that Excel is not installed. I'd rather tell the user beforehand that Excel needs to be installed.</p></li>
  </ol>