GetOS Version

Pascal Code


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
 
unit GetSystemVersion;

interface

uses
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
  Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Vcl.Buttons;

type
  TMainFrm = class(TForm)
    edt1: TEdit;
    lbl1: TLabel;
    btn1: TBitBtn;
    procedure btn1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
    function GetWindowsVersionString: AnsiString;
    function GetWindowsVersion: String;

end;

var
  MainFrm: TMainFrm;

implementation

{$R *.dfm}

function TMainFrm.GetWindowsVersionString : AnsiString;
var
VI: TOSVersionInfoA;
begin
  VI.dwOSVersionInfoSize := SizeOf(TOSVersioninfoA);
  if GetVersionExA(VI) then
  with VI do
  Result := Trim (
  Format(
      ‘%d.%d build %d %s‘,
      [dwMajorVersion, dwMinorVersion,dwBuildNumber,szCSDVersion]
  )
  )

else
  Result:= ‘‘;

end;

procedure TMainFrm.btn1Click(Sender: TObject);
begin
edt1.Text := GetWindowsVersion;
end;

function TMainFrm.GetWindowsVersion : String;
var
AWin32Version : Extended;
OS: string;

begin
  OS:= ‘Windows  ‘;
  AWin32Version := StrToFloat(Format(‘%d.%d‘,[Win32MajorVersion, Win32MinorVersion]));
  if Win32Platform = VER_PLATFORM_WIN32s then
  Result := OS + ‘32‘
  else if Win32Platform = VER_PLATFORM_WIN32_WINDOWS then
       begin
      if AWin32Version = 4.0 then
           Result := OS + ‘95‘
         else if AWin32Version = 4.1 then
           Result := OS + ‘98‘
         else if AWin32Version = 4.9 then
           Result := OS + ‘Me‘
         else
           Result := OS + ‘9X‘
       end
  else if Win32Platform = VER_PLATFORM_WIN32_NT then
         begin
                 if AWin32Version = 3.51 then

Result := OS + ‘NT 3.51‘
                  else if AWin32Version = 4.0 then
                       Result := OS + ‘NT 4.0‘
                       else if AWin32Version = 5.0 then
                            Result :=OS + ‘2000‘
                            else if AWin32Version = 5.1 then
                                 Result := OS + ‘XP‘
                                 else if AWin32Version = 5.2 then
                                      Result := OS + ‘2003‘
                                      else if AWin32Version = 6.0 then
                                           Result:=  OS +‘Vista‘
                                           else if AWin32Version = 6.1 then
                                               Result := OS + ‘7‘
                                               else if AWin32Version = 6.2 then
                                                    Result := OS + ‘8‘
                                               else
                                               Result := OS + ‘Other NT Kernal Windows‘;

end
  else

Result := OS;

end;

end.

时间: 2024-12-20 12:36:19

GetOS Version的相关文章

maven -- 问题解决(三)Java compiler level does not match the version of the installed Java project facet

问题: Java compiler level does not match the version of the installed Java project facet 解决方法如下: properties->Java Compiler,修改JDK版本,然后Apply

异常:Unsupported major.minor version 52.0 (Use --stacktrace to see the full trace)

异常:Unsupported major.minor version 52.0 (Use --stacktrace to see the full trace) 正在写一个功能,更新了同事提交的代码之后,出现了如下错误: 1 Fatal error during compilation org.apache.tools.ant.BuildException: java.lang.UnsupportedClassVersionError: org/elasticsearch/index/query

How to Downgrade VMware ESXi 5.5 Virtual Machine Hardware Version to 9 from 10

Shut down the virtual machine in the vSphere client. Remove your virtual machine from the ESXi inventory. Browse your Datastore and find the virtual machine's .vmx file.   Download it to your desktop. Open the .vmx file in Notepad or your favorite te

This version of MySQL doesn't yet support 'LIMIT & IN/ALL/ANY/SOME subquery' 错误解决

原因是内层select语句带有limit子句. 原: update stu_score_childen A  set  A.fScore='-1' where  A.fID in (select B.fID from stu_score_childen B limit 0,50 ) 更改后的 update stu_score_childen A  set  A.fScore='-1' where  A.fID in (select C.fID from (select B.fID from st

[LeetCode] Compare Version Numbers

Question: Compare two version numbers version1 and version2.If version1 > version2 return 1, if version1 < version2 return -1, otherwise return 0. You may assume that the version strings are non-empty and contain only digits and the . character.The 

This version of the rendering library is more recent than your version of IntelliJ IDEA.

今天往idea里导入其他项目时又遇到了一个问题,单独标记一下. 导入后打开一个布局xml文件,发现不能渲染,报错为: This version of the rendering library is more recent than your version of IntelliJ IDEA. Please update IntelliJ IDEA 看字面意思就是idea的渲染库版本不对,让你升级idea.因为之前升级过android sdk,就想到了以前eclipse的老问题:adt的升级.难

eclipse中,项目有红叉之-Cannot change version of project facet Dynamic Web Module to 3.1

1.打开Problems查看错误原因Window->Show View->Other->General->Problems 2.查看问题 3.发现是Cannot change version of project facet Dynamic Web Module to 3.1 4.根据2里截图的Resource,得到是哪个项目,项目右击->Properties->Project Faces->Dynamic Web Module,更据相应Dynamic Web M

Type Java compiler level does not match the version of the installed Java project facet.项目内容没错但是项目上报错,不影响运行

1.Window->Show View->Problems 2.在项目上右键properties->project Facets->修改右侧的version  保持一致 3.window->preferences->Java->Compiler->设置右侧的Compiler compliance level 4.window->preferences->java->Installed JREs->设置或者选择右侧的Installed

cassandra的schema version, gossip_generation 和host id

这是cassandra里面很重要的三个值; schema version是cassandra cluster里每个node的schema版本,什么叫版本呢?因为cassandra是无中心化的,所以你很难知道所有的node上的schema是否是一致的.你不可能每次把所有的schema都拿了去比较一次.这样很不高效.所以cassandra里就有了schema version这个概念.每次执行DDL操作的时候,都会新生成一个新的schema version, 当这个DDL操作复制到其他node的时候,