I’m writing a software that in a given moment needs to find if a given software is already installed (by its name) – so the same thing a installer does when it’s going to installad its software and sometimes allerts that that software is already installed in the PC.
The problem is that I don’t know which would be a good way of doing this. Now the softwares just looks to the default folder and if its unable to find the .exe, he then asks for the user to point out where he installed the software or else consider it uninstalled.
But I would like it to do things by its own; it should be capable of finding if a software is installed without user inputs, and I’m not sure which would be an efficient way of doing this.
The only way I found now is to do the same thing Windows’ Add/Remove Programs does: look at many registry entries and try to found it, but I think this would take too much unacessary time give the fact it would look in many places to find only one software.
So isn’t there any other less costful option in C++?
Thanks,
Momergil
what you are looking for is a key path: a registry location that is uniquely tied to that software.
You have two options:
eg. HKEY_CURRENT_USER\Software\BitTorrent\uTorrent
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall&HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\UninstallYou will always find a REG_SZ here titled DisplayName which is used as the title in “Add Remove Software” Control Panel extension.