代码之家  ›  专栏  ›  技术社区  ›  Andreas Rejbrand

GetVersionEx在Windows 7上不工作?

  •  6
  • Andreas Rejbrand  · 技术社区  · 16 年前

    在我的Windows7系统上,getVersionExWindowsAPI函数返回“6.0”,表示Windows Vista在运行时 should 返回“6.1”。

    如果

    function winver: string;
    var
      ver: TOSVersionInfo;
    begin
      ver.dwOSVersionInfoSize := SizeOf(ver);
      if GetVersionEx(ver) then
        with ver do
          result := IntToStr(dwMajorVersion) + '.' + IntToStr(dwMinorVersion) + '.' + IntToStr(dwBuildNumber) + ' (' + szCSDVersion + ')';
    end;
    

    这不是很奇怪吗?

    3 回复  |  直到 16 年前
        1
  •  9
  •   Andreas Rejbrand    16 年前

        2
  •  8
  •   Dirk Vollmar    16 年前

    您的可执行文件是否在定义了任何兼容性设置的情况下运行(我假设对于传统的Delphi应用程序可能是这种情况)?文件 GetVersionEx 国家:

    也许 吧 GetProductInfo

        3
  •  1
  •   Chris Thornton    16 年前

    我想可能只有你。i、 e.您的D2009可能已被windows标记为需要在兼容模式下运行。