Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Version of Windows 2

Status
Not open for further replies.

engale

Programmer
May 9, 2003
14
CO
Hi all,

How can i know (with witch function or procedure) in my application the version of win to make a decision between Win NT/2000/XP and win 95/98/me, etc.

Thankx a lot.

Alejandro
 
Check out my FAQ entitled:
How do I determine the Windows OS version?
faq102-3232

It detects the following Windows versions:
3.1, 95, 98, ME, NT, 2000, XP and .NET Server

I hope this helps!

Clive [infinity]
Ex nihilo, nihil fit (Out of nothing, nothing comes)
 
I just read your question again. If you simply want to differentiate between the two groups (95-based (i.e. 95/98/ME) and NT-based (i.e. NT/2000/XP)) of operating systems then use a shortened version of my code:
Code:
function GetOS: String;
var
  VersionInfo: TOSVersionInfo;
  PlatformId: string;
begin
  VersionInfo.dwOSVersionInfoSize := SizeOf(VersionInfo);
  GetVersionEx(VersionInfo);
  // Detect platform
  case VersionInfo.dwPlatformId of
    // Test for the Windows 95 product family
    VER_PLATFORM_WIN32_WINDOWS:
      PlatformId := '95-based Operating System';
    // Test for the Windows NT product family
    VER_PLATFORM_WIN32_NT:
      PlatformId := 'NT-based Operating System'
  end;
  Result := 'Microsoft Windows ' + PlatformId;
end;


Clive [infinity]
Ex nihilo, nihil fit (Out of nothing, nothing comes)
 
Hi Clive,

I´m working in Delphi 7, and when i place your code there is an Error.

[Error] Unit1.pas(490): Illegal character in input file: ' ' ($A0)

what can it be?... Have i place any class in "uses".

thanx,

Alejandro
 
U shouldn't need to include anything in the "uses" list.
Could you print line 490 of unit1, i think that's where the error is occurring.

Clive [infinity]
Ex nihilo, nihil fit (Out of nothing, nothing comes)
 
Oh...Sorry...

there was a copy paste problem. :), it seems that there was a character invalid in the code, but invisible!..i have to supress all the spaces and reindent. and it Works!!
waird isn´t it?

i have fix it allready. thanx anyway, this example is very helpful.

Alejandro
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top