How can I check what version/edition of Visual Studio is installed programmatically?

前端 未结 10 1130
萌比男神i
萌比男神i 2020-12-16 09:16

I could read registry HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\10.0. However, it doesn\'t give me any information about the edition of it - Profes

10条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-16 09:52

    Put this code somewhere in your C++ project:

    #ifdef _DEBUG
    TCHAR version[50];
    sprintf(&version[0], "Version = %d", _MSC_VER);
    MessageBox(NULL, (LPCTSTR)szMsg, "Visual Studio", MB_OK | MB_ICONINFORMATION);
    #endif
    

    Note that _MSC_VER symbol is Microsoft specific. Here you can find a list of Visual Studio versions with the value for _MSC_VER for each version.

提交回复
热议问题