Reputation: 50774
I need to detect programmatically if Microsoft Excel 2016 (normal Office flavor) or Microsoft Excel (Office 365 flavor) is installed.
Detecting Microsoft Excel 2016 (normal Office flavor) is no problem it works fine, but detecting Excel Office 365 is a bit more trickier.
What I do now:
HKEY_CLASSES_ROOT\.xlsmm\OpenWithProgids
"AppXdns5t4sbk...."
)This is quite hacky, and if anybody knows a cleaner way, I'd be grateful to learn about it.
Edit:
The reason I need this:
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
When I simply try to open the .xls file with ShellExecuteEx
and Excel is not installed, then the Windows 10 standard "How do you want to open this file" dialog pops up.
Even if ShellExecuteEx
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.
Upvotes: 0
Views: 2389
Reputation: 3777
I would recommend instead checking if any of the DisplayName
s located in the HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall
path contain Microsoft Office 365
.
Upvotes: 1