荔园在线

荔园之美,在春之萌芽,在夏之绽放,在秋之收获,在冬之沉淀

[回到开始] [上一篇][下一篇]


发信人: Peter (小飞侠), 信区: Program
标  题: How to get the windows and DOS versions
发信站: BBS 荔园晨风站 (Tue Jan 26 22:25:38 1999), 转信


     Product: Delphi
     Version: 1.0
     Platform: Windows



Q:  How can I get the Windows or DOS version numbers?

A:  The API call GetVersion will do it, but the information is
encrypted into a longint.  Here is how to get and decrypt the information:

  Type
    TGetVer = record
      WinVer,
      WinRev,
      DosRev,
      DosVer: Byte;
    end;
  const
    VerStr = '%d.%d';

  procedure TForm1.Button1Click(Sender: TObject);
  var
    AllVersions: TGetVer;
  begin
    AllVersions := TGetVer(GetVersion);
    Edit1.Text := Format(VerStr, [AllVersions.WinVer, AllVersions.WinRev]);
    Edit2.Text := Format(VerStr, [AllVersions.DOSVer, AllVersions.DOSRev]);
  end;

Note1:  The values that windows displays for the versions and the values
that it returns through its API call are not always the same.  e.g.  The
workgroup version displays as 3.10 rather than 3.11.

Note2: Win32 applications should call GetVersionEx rather than GetVersion.

--
※ 来源:.BBS 荔园晨风站 bbs.szu.edu.cn.[FROM: 192.168.1.3]


[回到开始] [上一篇][下一篇]

荔园在线首页 友情链接:深圳大学 深大招生 荔园晨风BBS S-Term软件 网络书店