【问题标题】:Getting application version number in Lazarus project not working在 Lazarus 项目中获取应用程序版本号不起作用
【发布时间】:2014-08-21 12:24:35
【问题描述】:

我正在使用以下单元尝试读取 Lazarus 项目中的应用程序版本号,但 GetProductVersion 始终返回 0.0.0.0

http://forum.lazarus.freepascal.org/index.php?topic=13957

我在 Windows 7 上使用 Lazarus 1.2.4 和 FPC 2.6.4。

当我编译、链接和运行应用程序时,我没有收到任何错误,因此看起来该单元已正确包含...

我不知道还能去哪里寻找不起作用的东西。谁能指点一下?

【问题讨论】:

  • 您可能还想使用 Mike Thompson 的 VersionSupport 单元。它适用于各种 Linux 发行版(使用 Ubuntu、SuSe 和 Raspbian 测试)、Windows(从 2000 年测试到 Win 7)和 Mac OS X(从 10.4 到 10.10 测试)
  • @jwdietrich 这就是我正在使用的代码 - 看来我可能发布了错误的链接。我明天会修复这个帖子。
  • @abelisto 我来看看 - 原生方式看起来更安全。
  • @jwdietrich 我最后得到了它。我显然没有看清楚,而是在项目选项中设置 FileVersion 并在代码中读取 FileVersion。

标签: windows-7 version freepascal lazarus


【解决方案1】:

我终于明白了这一点.. 这只是一个小问题,可能会对某人有所帮助,所以我会发布我做错了什么。

一个Lazarus项目中其实有3个不同的版本,都在Project Options-> Version info:

  1. 版本号,在它自己的小盒子里。
  2. ProductVersion,在“其他信息”中。
  3. FileVersion,位于“其他信息”中。

当您阅读 http://forum.lazarus.freepascal.org/index.php?topic=13957 上的 Mike.Cornflakes 描述时,这实际上很明显,但我并没有看到树木的木材。

只要确保您设置了一个值,您正在使用 Mike 的函数读取正确的值。

(上面链接中的讨论还解释了使用 FileVersion 和 ProductVersion 之间的区别(显然 Windows 文档指定 Product Version 表示应该使用 dll 的产品版本。)

【讨论】:

  • 感谢您澄清这一点。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2013-02-14
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多