【delphi开源代码栏目提醒】:网学会员--在 delphi开源代码编辑为广大网友搜集整理了:frm_version.pas绩等信息,祝愿广大网友取得需要的信息,参考学习。
unit frm_version;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls, XPMan;
type
TFrmVersion = class(TForm)
RGpVersion: TRadioGroup;
BtnGetVersion: TButton;
XPManifest1: TXPManifest;
BtnClose: TButton;
procedure BtnGetVersionClick(Sender: TObject);
procedure BtnCloseClick(Sender: TObject);
private
Function GetWinVersion:integer;
{ Private declarations }
public
{ Public declarations }
end;
var
FrmVersion: TFrmVersion;
implementation
{$R *.dfm}
Function TFrmVersion.GetWinVersion:integer;
var
version:TOSVersionInfo;
begin
//result 0 is Winxp
//result 1 is Windows NT
//result 2 is Windows 98
//result 3 is windows 2000
result:=-1;
Version.dwOSVersionInfoSize:=sizeof(TOSVersionInfo);
Getversionex(version);
case Version.dwPlatformId of
VER_PLATFORM_WIN32_NT:
begin
if (version.dwMajorVersion=5) and (version.dwMinorVersion=1) then
result:=0;
if (version.dwMajorVersion=4) and (version.dwMinorVersion=0) then
result:=1;
if (version.dwMajorVersion=5) and (version.dwMinorVersion=0) then
result:=3;
end;
VER_PLATFORM_WIN32_WINDOWS:
begin
result:=2;
end;
end;
end;
procedure TFrmVersion.BtnGetVersionClick(Sender: TObject);
begin
RGPVersion.ItemIndex:=GetWinVersion;
end;
procedure TFrmVersion.BtnCloseClick(Sender: TObject);
begin
Close;
end;
end.