I am having a project to show Windows Version with Edition Type strting from "Windows 95" to "Windows 8" using Delphi XE2. Firstly I have tried "TOSVersion" Function. But the problem is :
procedure TMainForm.BitBtn01Click(Sender: TObject);
var
VersionNameOfOperatingSystem : String;
begin
VersionNameOfOperatingSystem := TOSVersion.Name;
Edit01.Text := VersionNameOfOperatingSystem;
end
Shows only "Windows" in Windows 8 Environment" and another problem is that Ii can not detect "Windows Edition". Then I ahve tried "GetProductInfo" Function. But here is another problem :
function GetProductInfo(dwOSMajorVersion, dwOSMinorVersion, dwSpMajorVersion,
dwSpMinorVersion: DWORD; pdwReturnedProductType: PDWORD): BOOL stdcall;
external kernel32;
procedure TMainForm.BitBtn01Click(Sender: TObject);
var
rpt: cardinal;
begin
if GetProductInfo(6, 0, 0, 0, @rpt) then Edit02.Text :=IntToStr(rpt);
end
and
function GetProductInfo(dwOSMajorVersion, dwOSMinorVersion, dwSpMajorVersion,
dwSpMinorVersion: DWORD; pdwReturnedProductType: PDWORD): BOOL stdcall;
external kernel32;
procedure TMainForm.BitBtn01Click(Sender: TObject);
var
rpt: cardinal;
begin
if GetProductInfo(6, 1, 0, 0, @rpt) then Edit02.Text :=IntToStr(rpt);
end
and
function GetProductInfo(dwOSMajorVersion, dwOSMinorVersion, dwSpMajorVersion,
dwSpMinorVersion: DWORD; pdwReturnedProductType: PDWORD): BOOL stdcall;
external kernel32;
procedure TMainForm.BitBtn01Click(Sender: TObject);
var
rpt: cardinal;
begin
if GetProductInfo(6, 2, 0, 0, @rpt) then Edit02.Text :=IntToStr(rpt);
end
and
function GetProductInfo(dwOSMajorVersion, dwOSMinorVersion, dwSpMajorVersion,
dwSpMinorVersion: DWORD; pdwReturnedProductType: PDWORD): BOOL stdcall;
external kernel32;
procedure TMainForm.BitBtn01Click(Sender: TObject);
var
rpt: cardinal;
begin
if GetProductInfo(6, 2, 2, 2, @rpt) then Edit02.Text :=IntToStr(rpt);
end
produces the same result If I run the compiled exe file in Windows Vista Enterprise SP2 and the same can not be used earlier version of Windows. If I call "TOSVersion" as follows
begin
TOSVersion.Platform of
pfWindows :
begin
.
.
.
.
end
else
beging
.
.
.
end
end;
and the call "GetProductInfo" then I am getting "Error" telling that both can not called simutaneously. At last I have try "OSVERSIONINFO Structure" to identify whether it is "Server" or not and "GetVersionEx Function" for "Windows XP Edition Type". I am totally confused how to start my programming. There are so many experienced coder in this forum. Anybody can write down the complete program. I have googled it but all the available programs are upto "Windows 7" not updated. And one availabe in this forum is also upto "Windows 7" and not updated. Please don't tell "We cannot sit at your keyboard and type the code for you". Please help me.