从应用程序中获取应用程序版本 [英] Getting application version from within application

查看:141
本文介绍了从应用程序中获取应用程序版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在运行时是否有一种从资源文件获取应用程序版本信息的简单方法?

Is there a simple way of obtaining the application version information from the resource file at runtime?

有效地我想做的是能够在运行时显示版本XYZ,而不需要在我需要保存的某个单独的变量与我的ProductVersion和FileVersion同步。

Effectively what I'd like to do is be able to have a "Version X.Y.Z" displayed at runtime without having a separate variable somewhere that I'd have to keep in sync with my ProductVersion and FileVersion.

澄清:是的,这是一个标准的C ++ Windows项目。我知道 GetFileVersionInfo 方法,但它似乎愚蠢的必须打开二进制文件的版本在内存中查询版本信息 - 我相信我缺少一些明显的在这里: - )

To clarify: yes this is a standard C++ Windows project. I am aware of the GetFileVersionInfo method but it seems silly to have to open the binary from within the version in memory just to query the version information - I'm sure I'm missing something obvious here :-)

推荐答案

如果操作系统是Windows,请使用 GetFileVersionInfo VerQueryValue

If the OS is Windows, use the GetFileVersionInfo and VerQueryValue functions.

这篇关于从应用程序中获取应用程序版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆