vcredist_x86 vs2013检查

版权声明:随意乱写,切勿当真! https://blog.csdn.net/pehao/article/details/79614545

注册表位置:


HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{13A4EE12-23EA-3371-91EE-EFB36DDFFF3E}

C# 判断

            /**
    * 
           安装状态                       返回整数值      含义
           INSTALLSTATE_INVALIDARG       -2            无效的参数传递给该函数。
           INSTALLSTATE_UNKNOWN          -1            不公布或者未安装该产品。
           INSTALLSTATE_ADVERTISED       1             该产品已公布但尚未安装。
           INSTALLSTATE_ABSENT            2             不同的用户安装该产品。
           INSTALLSTATE_DEFAULT          5              为当前用户安装该产品
    * 2013(X64) {929FBD26-9020-399B-9A7A-751D61F0B942}
    * 2013(X86) {13A4EE12-23EA-3371-91EE-EFB36DDFFF3E}
    */
            [DllImport("msi.dll", CharSet = CharSet.Unicode)]
            private static extern int MsiQueryProductStateW(string product);
            /// <summary>
            /// 
            /// </summary>
            /// <returns></returns>
            public static bool CheckMsi()
            {
                //返回5,正常;
                var res = MsiQueryProductStateW("{13A4EE12-23EA-3371-91EE-EFB36DDFFF3E}");
                return res == 5;
            }

猜你喜欢

转载自blog.csdn.net/pehao/article/details/79614545