Reading current installed version of an application using windows api

后端 未结 3 769
清歌不尽
清歌不尽 2021-01-21 08:17

I was trying to use windows api to find out the version info of an installed application.

I used the upgrade code to find out the product code using MsiEnumRelatedProduc

3条回答
  •  悲&欢浪女
    2021-01-21 08:58

    Here is what I did that my solved my problem.

            Int32 m_len = 11512;
            StringBuilder m_versionInfo = new StringBuilder(m_len);
    
            StringBuilder m_sbProductCode = GetProductCodeFromMsiUpgradeCode();
            MsiGetProductInfo(m_sbProductCode.ToString(), "**VersionString**", m_versionInfo, ref m_len);
    
            return m_versionInfo.ToString();
    

    This did return me the version string ,and also converted from decimal into string format like 1.4.3.

提交回复
热议问题