简体   繁体   中英

How to get installed version of Microsoft Visual C++ Redistributable(x64) in mfc application

I working on mfc application in which I need to check currently installed version Microsoft Visual C++ Redistributable. Is there any way?

Each VS Version has its own redistributable files and they are named with a version number in the name.

So there is no "current" version. There may be several installations for different VS-Versions.

Usually the files are installed in the Windows\\System32 directory for 64bit. So lookup the file you need and search for (ie MFC140u.dll) and you can determine it's version.

Also some programs may have a local copy of the runtime DLLs in their application directory...

I've written an application that inspects the customer installation. It works somewhat like the Microsoft Troubleshooters in that it identifies certain information about the user installation so that our tech support people can identify a potential problem with the customer installation. One of the things it reports on is the VC redistributables that are installed. I accomplish this by interrogating the following LOCAL MACHINE registry key:

SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall

The code iterates through the sub-keys looking for a match on the “DisplayName” attribute of each sub-key. I look for “Microsoft”, “Visual”, “C++”, and “Redistributable”. If all strings are found, I collect the “DisplayVersion” attribute and report it to a dialog.

While this scheme will not indicate the "current" version, it should provide access to all versions that are installed.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM