unit UnitZeigeWindowsVersion;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, Registry,
StdCtrls;
type
TForm1 =
class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
procedure FormShow(Sender: TObject);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
function GetWindowsVersion(ShortInfo: Boolean):
string;
var
VerInfo: TOsversionInfo;
PlatformId, VersionNumber:
string;
BuildNumber:
string;
// mein Pfusch!
Reg: TRegistry;
begin
VerInfo.dwOSVersionInfoSize := SizeOf(VerInfo);
GetVersionEx(VerInfo);
Reg := TRegistry.Create;
Reg.RootKey := HKEY_LOCAL_MACHINE;
case VerInfo.dwPlatformId
of
VER_PLATFORM_WIN32s:
begin
PlatformId := '
Windows 3.1';
end;
VER_PLATFORM_WIN32_WINDOWS:
begin
Reg.OpenKey('
\SOFTWARE\Microsoft\Windows\CurrentVersion', False);
PlatformId := Reg.ReadString('
ProductName');
VersionNumber := Reg.ReadString('
VersionNumber');
BuildNumber := Reg.ReadString('
CurrentBuildNumber');
// mein Pfusch!
end;
VER_PLATFORM_WIN32_NT:
begin
Reg.OpenKey('
\SOFTWARE\Microsoft\Windows NT\CurrentVersion', False);
PlatformId := Reg.ReadString('
ProductName');
VersionNumber := Reg.ReadString('
CurrentVersion');
BuildNumber := Reg.ReadString('
CurrentBuildNumber');
// mein Pfusch!
end;
end;
Reg.Free;
if shortinfo
then
Result := '
(' + VersionNumber + '
/' + BuildNumber + '
)'
else
Result := PlatformId + '
(Version ' + VersionNumber + '
/Build ' + BuildNumber + '
)';
end;
procedure TForm1.Button1Click(Sender: TObject);
var s:
string;
begin
s := GetWindowsVersion(false);
// Kurzinfo
MessageBox(
Handle, PChar(s), '
Infokram (false) unter D5', mb_Ok
or mb_IconInformation
or mb_DefButton1);
s := GetWindowsVersion(true);
// Langinfo
MessageBox(
Handle, PChar(s), '
Infokram (true) unter D5', mb_Ok
or mb_IconInformation
or mb_DefButton1);
end;
procedure TForm1.FormShow(Sender: TObject);
begin
Button1Click(self);
PostQuitMessage(666);
// Teufelszeug!
end;
end.